Documentation ¶
Overview ¶
Package cqr provides a common query representation for keyword and Boolean queries in go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ExplodedString = "exploded" TruncatedString = "truncated" AND = "and" OR = "or" NOT = "not" )
Functions ¶
func IsBoolean ¶
func IsBoolean(query CommonQueryRepresentation) bool
Types ¶
type BooleanQuery ¶
type BooleanQuery struct { Operator string `json:"operator"` Children []CommonQueryRepresentation `json:"children"` Options map[string]interface{} `json:"options"` }
BooleanQuery is a nested set of queries, containing either more Boolean queries, or keywords.
func NewBooleanQuery ¶
func NewBooleanQuery(operator string, children []CommonQueryRepresentation) BooleanQuery
NewBooleanQuery constructs a new Boolean query.
func (BooleanQuery) GetOption ¶
func (b BooleanQuery) GetOption(key string) interface{}
GetOption gets an optional parameter of the Boolean Query.
func (BooleanQuery) SetOption ¶
func (b BooleanQuery) SetOption(key string, value interface{}) CommonQueryRepresentation
SetOption sets an optional parameter on the Boolean query.
func (BooleanQuery) String ¶
func (b BooleanQuery) String() (s string)
String computes the string representation of a Boolean query.
func (BooleanQuery) StringPretty ¶
func (b BooleanQuery) StringPretty() (s string)
String computes the string representation of a Boolean query.
type CommonQueryRepresentation ¶
type CommonQueryRepresentation interface { String() string StringPretty() string GetOption(string) interface{} SetOption(string, interface{}) CommonQueryRepresentation }
CommonQueryRepresentation is the parent type for all subtypes.
type Keyword ¶
type Keyword struct { QueryString string `json:"query"` Fields []string `json:"fields"` Options map[string]interface{} `json:"options"` }
Keyword is a single query expression.
func CopyKeyword ¶
func NewKeyword ¶
NewKeyword constructs a new keyword.
func (Keyword) SetOption ¶
func (k Keyword) SetOption(key string, value interface{}) CommonQueryRepresentation
SetOption sets an optional parameter on the keyword.
func (Keyword) StringPretty ¶
Click to show internal directories.
Click to hide internal directories.