forked from aquasecurity/esquery
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.go
34 lines (28 loc) · 845 Bytes
/
common.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
package esquery
// Source represents the "_source" option which is commonly accepted in ES
// queries. Currently, only the "includes" option is supported.
type Source struct {
includes []string
excludes []string
}
// Map returns a map representation of the Source object.
func (source Source) Map() map[string]interface{} {
m := make(map[string]interface{})
if len(source.includes) > 0 {
m["includes"] = source.includes
}
if len(source.excludes) > 0 {
m["excludes"] = source.excludes
}
return m
}
// Sort represents a list of keys to sort by.
type Sort []map[string]interface{}
// Order is the ordering for a sort key (ascending, descending).
type Order string
const (
// OrderAsc represents sorting in ascending order.
OrderAsc Order = "asc"
// OrderDesc represents sorting in descending order.
OrderDesc Order = "desc"
)