forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfacet_base.go
40 lines (32 loc) · 1.06 KB
/
facet_base.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
package ravendb
type FacetBase interface {
// those are supplied by each type
ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)
// those are inherited from FacetBaseCommon
SetDisplayFieldName(string)
GetOptions() *FacetOptions
SetOptions(*FacetOptions)
GetAggregations() map[FacetAggregation]string
}
type FacetBaseCommon struct {
DisplayFieldName string `json:"DisplayFieldName,omitempty"`
Options *FacetOptions `json:"Options"`
Aggregations map[FacetAggregation]string `json:"Aggregations"`
}
func NewFacetBaseCommon() FacetBaseCommon {
return FacetBaseCommon{
Aggregations: make(map[FacetAggregation]string),
}
}
func (f *FacetBaseCommon) SetDisplayFieldName(displayFieldName string) {
f.DisplayFieldName = displayFieldName
}
func (f *FacetBaseCommon) GetOptions() *FacetOptions {
return f.Options
}
func (f *FacetBaseCommon) SetOptions(options *FacetOptions) {
f.Options = options
}
func (f *FacetBaseCommon) GetAggregations() map[FacetAggregation]string {
return f.Aggregations
}