Skip to content

Commit f35d30f

Browse files
committed
Add simple filter, add error to creation
1 parent 93bbdb2 commit f35d30f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

filter/simple.go

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package filter
2+
3+
type Operation string
4+
5+
const (
6+
// Equals
7+
OpEQ Operation = "eq"
8+
9+
// Not Equals
10+
OpNEQ Operation = "neq"
11+
12+
// Less Than
13+
OpLT Operation = "lt"
14+
15+
// Less Than or Equals
16+
OpLTE Operation = "lte"
17+
18+
// Greater Than
19+
OpGT Operation = "gt"
20+
21+
// Greater Than or Equals
22+
OpGTE Operation = "gte"
23+
)
24+
25+
type Simple struct {
26+
// The key to filter by
27+
Key string `json:"key"`
28+
29+
// The filter operation
30+
Operation Operation `json:"op"`
31+
32+
// The filter value
33+
Value interface{} `json:"val"`
34+
}

plugins/types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type Filter interface {
6060
ValidateFilter(filter filter.ProcessedFilter) (bool, error)
6161

6262
// Create a new instance of the filter
63-
CreateFilter(filter string) interface{}
63+
CreateFilter(filter string) (interface{}, error)
6464
}
6565

6666
type Registry interface {

0 commit comments

Comments
 (0)