github.com/altipla-consulting/ravendb-go-client@v0.1.3/facet_base.go (about)

     1  package ravendb
     2  
     3  type FacetBase interface {
     4  	// those are supplied by each type
     5  	ToFacetToken(addQueryParameter func(interface{}) string) (*facetToken, error)
     6  
     7  	// those are inherited from FacetBaseCommon
     8  	SetDisplayFieldName(string)
     9  	GetOptions() *FacetOptions
    10  	SetOptions(*FacetOptions)
    11  	GetAggregations() map[FacetAggregation]string
    12  }
    13  
    14  type FacetBaseCommon struct {
    15  	DisplayFieldName string                      `json:"DisplayFieldName,omitempty"`
    16  	Options          *FacetOptions               `json:"Options"`
    17  	Aggregations     map[FacetAggregation]string `json:"Aggregations"`
    18  }
    19  
    20  func NewFacetBaseCommon() FacetBaseCommon {
    21  	return FacetBaseCommon{
    22  		Aggregations: make(map[FacetAggregation]string),
    23  	}
    24  }
    25  
    26  func (f *FacetBaseCommon) SetDisplayFieldName(displayFieldName string) {
    27  	f.DisplayFieldName = displayFieldName
    28  }
    29  
    30  func (f *FacetBaseCommon) GetOptions() *FacetOptions {
    31  	return f.Options
    32  }
    33  
    34  func (f *FacetBaseCommon) SetOptions(options *FacetOptions) {
    35  	f.Options = options
    36  }
    37  
    38  func (f *FacetBaseCommon) GetAggregations() map[FacetAggregation]string {
    39  	return f.Aggregations
    40  }