github.com/go-graphite/carbonapi@v0.17.0/expr/functions/verticalLine/function.go (about) 1 //go:build !cairo 2 // +build !cairo 3 4 package verticalLine 5 6 import ( 7 "context" 8 "fmt" 9 10 "github.com/go-graphite/carbonapi/expr/interfaces" 11 "github.com/go-graphite/carbonapi/expr/types" 12 "github.com/go-graphite/carbonapi/pkg/parser" 13 ) 14 15 var UnsupportedError = fmt.Errorf("must build w/ cairo support") 16 17 type verticalLine struct{} 18 19 func GetOrder() interfaces.Order { 20 return interfaces.Any 21 } 22 23 func New(_ string) []interfaces.FunctionMetadata { 24 res := make([]interfaces.FunctionMetadata, 0) 25 26 f := &verticalLine{} 27 functions := []string{"verticalLine"} 28 for _, n := range functions { 29 res = append(res, interfaces.FunctionMetadata{Name: n, F: f}) 30 } 31 32 return res 33 } 34 35 func (f *verticalLine) Do(_ context.Context, _ interfaces.Evaluator, _ parser.Expr, _, _ int64, _ map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error) { 36 return nil, UnsupportedError 37 } 38 39 func (f *verticalLine) Description() map[string]types.FunctionDescription { 40 return map[string]types.FunctionDescription{ 41 "verticalLine": { 42 Description: "Draws a vertical line at the designated timestamp with optional\n 'label' and 'color'. This function is unsupported in this build (built w/o Cairo).", 43 Function: "verticalLine(ts, label=None, color=None)", 44 Group: "Graph", 45 Module: "graphite.render.functions", 46 Name: "verticalLine", 47 Params: []types.FunctionParam{ 48 { 49 Name: "ts", 50 Required: true, 51 Type: types.Date, 52 }, 53 { 54 Name: "label", 55 Required: false, 56 Type: types.String, 57 }, 58 { 59 Name: "color", 60 Required: false, 61 Type: types.String, 62 }, 63 }, 64 }, 65 } 66 }