This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
/
expression_match_all.go
59 lines (45 loc) · 1.35 KB
/
expression_match_all.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
50
51
52
53
54
55
56
57
58
59
package tagquery
import (
"io"
"github.com/grafana/metrictank/schema"
)
type expressionMatchAll struct {
// we keep key, operator, value just to be able to convert the expression back into a string
expressionCommon
originalOperator ExpressionOperator
}
func (e *expressionMatchAll) Equals(other Expression) bool {
return e.key == other.GetKey() && e.GetOperator() == other.GetOperator() && e.value == other.GetValue()
}
func (e *expressionMatchAll) GetDefaultDecision() FilterDecision {
return Pass
}
func (e *expressionMatchAll) GetKey() string {
return e.key
}
func (e *expressionMatchAll) GetValue() string {
return e.value
}
func (e *expressionMatchAll) GetOperator() ExpressionOperator {
return MATCH_ALL
}
func (e *expressionMatchAll) GetOperatorCost() uint32 {
return 50
}
func (e *expressionMatchAll) RequiresNonEmptyValue() bool {
return false
}
func (e *expressionMatchAll) ResultIsSmallerWhenInverted() bool {
return true
}
func (e *expressionMatchAll) Matches(value string) bool {
return true
}
func (e *expressionMatchAll) GetMetricDefinitionFilter(_ IdTagLookup) MetricDefinitionFilter {
return func(_ schema.MKey, _ string, _ []string) FilterDecision { return Pass }
}
func (e *expressionMatchAll) StringIntoWriter(writer io.Writer) {
writer.Write([]byte(e.key))
e.originalOperator.StringIntoWriter(writer)
writer.Write([]byte(e.value))
}