-
Notifications
You must be signed in to change notification settings - Fork 495
/
from.go
36 lines (32 loc) · 836 Bytes
/
from.go
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
package tick
import (
"github.com/influxdata/kapacitor/pipeline"
"github.com/influxdata/kapacitor/tick/ast"
)
// FromNode converts the FromNode pipeline node into the TICKScript AST
type FromNode struct {
Function
}
// NewFrom creates a FromNode function builder
func NewFrom(parents []ast.Node) *FromNode {
return &FromNode{
Function{
Parents: parents,
},
}
}
// Build creates a from ast.Node
func (n *FromNode) Build(f *pipeline.FromNode) (ast.Node, error) {
n.Pipe("from").
Dot("database", f.Database).
Dot("retentionPolicy", f.RetentionPolicy).
Dot("measurement", f.Measurement).
DotIf("groupByMeasurement", f.GroupByMeasurementFlag).
Dot("round", f.Round).
Dot("truncate", f.Truncate).
Dot("where", f.Lambda)
if len(f.Dimensions) > 0 {
n.Dot("groupBy", f.Dimensions...)
}
return n.prev, n.err
}