forked from grafana/metrictank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
113 lines (93 loc) · 2.77 KB
/
types.go
File metadata and controls
113 lines (93 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// argument types. to let functions describe their inputs and outputs
package expr
import "regexp"
// Arg is an argument to a GraphiteFunc
// note how every implementation has a val property.
// this property should point to value accessible to the function.
// the value will be set up by the planner; it assures that
// by the time Func.Exec() is called, the function has access to all
// needed inputs, whether simple values, or in the case of ArgSeries*
// inputs other functions to call which will feed it data.
type Arg interface {
Key() string
Optional() bool
}
// ArgSeries is a single series argument
// not generally used as input since graphite functions typically take multiple series as input
// but is useful to describe output
type ArgSeries struct {
key string
opt bool
val *GraphiteFunc
}
func (a ArgSeries) Key() string { return a.key }
func (a ArgSeries) Optional() bool { return a.opt }
// ArgSeriesList is a list of series argument, it can be 0..N series
type ArgSeriesList struct {
key string
opt bool
val *GraphiteFunc
}
func (a ArgSeriesList) Key() string { return a.key }
func (a ArgSeriesList) Optional() bool { return a.opt }
// ArgSeriesLists represents one or more lists of series inputs.
type ArgSeriesLists struct {
key string
opt bool
val *[]GraphiteFunc
}
func (a ArgSeriesLists) Key() string { return a.key }
func (a ArgSeriesLists) Optional() bool { return a.opt }
// ArgInt is a number without decimals
type ArgInt struct {
key string
opt bool
validator []Validator
val *int64
}
func (a ArgInt) Key() string { return a.key }
func (a ArgInt) Optional() bool { return a.opt }
// ArgInts represents one or more numbers without decimals
type ArgInts struct {
key string
opt bool
validator []Validator
val *[]int64
}
func (a ArgInts) Key() string { return a.key }
func (a ArgInts) Optional() bool { return a.opt }
// floating point number; potentially with decimals
type ArgFloat struct {
key string
opt bool
validator []Validator
val *float64
}
func (a ArgFloat) Key() string { return a.key }
func (a ArgFloat) Optional() bool { return a.opt }
// string
type ArgString struct {
key string
opt bool
validator []Validator
val *string
}
func (a ArgString) Key() string { return a.key }
func (a ArgString) Optional() bool { return a.opt }
// like string, but should result in a regex
type ArgRegex struct {
key string
opt bool
validator []Validator
val **regexp.Regexp
}
func (a ArgRegex) Key() string { return a.key }
func (a ArgRegex) Optional() bool { return a.opt }
// True or False
type ArgBool struct {
key string
opt bool
val *bool
}
func (a ArgBool) Key() string { return a.key }
func (a ArgBool) Optional() bool { return a.opt }