forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.go
49 lines (43 loc) · 1.05 KB
/
delete.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
37
38
39
40
41
42
43
44
45
46
47
48
49
package pipeline
// Deletes fields and tags from data points.
//
// Example:
// stream
// |delete()
// .field('value')
// .tag('host')
//
// The above example will remove the field `value` and the tag `host`, from each point.
//
// Available Statistics:
//
// * fields_deleted -- number of fields that were deleted. Only counts if the field already existed.
// * tags_deleted -- number of tags that were deleted. Only counts if the tag already existed.
//
type DeleteNode struct {
chainnode
// Set of fields to delete
// tick:ignore
Fields []string `tick:"Field"`
// Set of tags to delete
// tick:ignore
Tags []string `tick:"Tag"`
}
func newDeleteNode(e EdgeType) *DeleteNode {
n := &DeleteNode{
chainnode: newBasicChainNode("delete", e, e),
}
return n
}
// Delete a field.
// tick:property
func (n *DeleteNode) Field(name string) *DeleteNode {
n.Fields = append(n.Fields, name)
return n
}
// Delete a tag.
// tick:property
func (n *DeleteNode) Tag(name string) *DeleteNode {
n.Tags = append(n.Tags, name)
return n
}