-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentities.go
82 lines (65 loc) · 2.06 KB
/
entities.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package elasticutil
import (
"time"
"github.com/olivere/elastic/v7"
)
type Ranges interface {
time.Time | uint64 | float64
}
// TimeRange represents a time range with a beginning and an end.
type TimeRange struct {
From time.Time
To time.Time
}
// IntRange represents an int range with a beginning and an end.
type IntRange struct {
From uint64
To uint64
}
// FloatRange represents a float range with a beginning and an end.
type FloatRange struct {
From float64
To float64
}
// Nested represents a nested query.
type Nested struct {
payload interface{}
}
// NewNested creates a Nested struct with the given payload.
func NewNested(payload interface{}) Nested {
return Nested{payload}
}
// FullTextSearchMust Represents a Must's Full Text Search.
type FullTextSearchMust struct {
payload interface{}
}
// NewFullTextSearchMust creates a FullTextSearchMust struct with the given payload.
func NewFullTextSearchMust(payload interface{}) FullTextSearchMust {
return FullTextSearchMust{payload}
}
// FullTextSearchMust Represents a Should's Full Text Search.
type FullTextSearchShould struct {
payload interface{}
}
// NewFullTextSearchShould creates a FullTextSearchShould struct with the given payload.
func NewFullTextSearchShould(payload interface{}) FullTextSearchShould {
return FullTextSearchShould{payload}
}
// CustomSearch is the struct that contains the CustomQuery function.
type CustomSearch struct {
GetQuery CustomQuery
}
// CustomQuery is the type function that will return the custom query.
type CustomQuery func() (*elastic.BoolQuery, error)
// NewCustomSearch creates a CustomSearch struct with the given CustomQuery function.
func NewCustomSearch(query CustomQuery) CustomSearch {
return CustomSearch{query}
}
// MultiMatchSearchShould Represents a Should's Multi Match Search.
type MultiMatchSearchShould struct {
payload interface{}
}
// NewMultiMatchSearchShould creates a MultiMatchSearchShould struct with the given payload.
func NewMultiMatchSearchShould(payload interface{}) MultiMatchSearchShould {
return MultiMatchSearchShould{payload}
}