forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneric_range_facet.go
35 lines (29 loc) · 1.04 KB
/
generic_range_facet.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
package ravendb
// GenericRangeFacet represents generic range facet
type GenericRangeFacet struct {
FacetBaseCommon
parent FacetBase
Ranges []*RangeBuilder
}
// NewGenericRangeFacet returns new GenericRangeFacet
// parent is optional, can be nil
func NewGenericRangeFacet(parent FacetBase) *GenericRangeFacet {
return &GenericRangeFacet{
FacetBaseCommon: NewFacetBaseCommon(),
parent: parent,
}
}
// GenericRangeFacetParse parses generic range facet
func genericRangeFacetParse(rangeBuilder *RangeBuilder, addQueryParameter func(interface{}) string) (string, error) {
return rangeBuilder.GetStringRepresentation(addQueryParameter)
}
// ToFacetToken returns facetToken from GenericRangeFacet
func (f *GenericRangeFacet) ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error) {
if f.parent != nil {
return f.parent.ToFacetToken(addQueryParameter)
}
return createFacetTokenWithGenericRangeFacet(f, addQueryParameter)
}
func (f *GenericRangeFacet) addRange(rng *RangeBuilder) {
f.Ranges = append(f.Ranges, rng)
}