Documentation
¶
Index ¶
- Constants
- Variables
- type Oper
- type Query
- type QueryStack
- type RangeOp
- type Value
- type ValueStack
- func (vs *ValueStack) Boolean(value string)
- func (vs *ValueStack) Date(filtered bool, value interface{})
- func (vs *ValueStack) DateRangeOrMatchTerm(filtered bool, value string)
- func (vs *ValueStack) Empty() bool
- func (vs *ValueStack) Exists()
- func (vs *ValueStack) Init(defField string)
- func (vs *ValueStack) Match(text interface{})
- func (vs *ValueStack) MatchTerm(filtered bool, value string)
- func (vs *ValueStack) Number(filtered bool, value interface{})
- func (vs *ValueStack) NumberRangeOrMatchTerm(filtered bool, value string)
- func (vs *ValueStack) Phrase(phrase string)
- func (vs *ValueStack) Pop() *Value
- func (vs *ValueStack) PopGroup() []*Value
- func (vs *ValueStack) Push(v *Value)
- func (vs *ValueStack) Range(value interface{})
- func (vs *ValueStack) SetField(field string)
- func (vs *ValueStack) SetNegation()
- func (vs *ValueStack) SetRangeOp(rop RangeOp)
- func (vs *ValueStack) StartGroup()
- func (vs *ValueStack) Term(term interface{})
- func (vs *ValueStack) Window(fromTildaTo string)
Constants ¶
const ( NoField = "__ERR_NO_FIELD_SET__" GroupInitField = "__GROUP_INIT__" )
Variables ¶
var ( // sentinel value marking the start of the "current" nested AND/OR clause, for stacking GroupInit = &Value{nil, GroupInitField, NoOp, false} // sentinel value for Value with as-yet-unset elastic.Query field NoQuery elastic.Query = nil )
Functions ¶
This section is empty.
Types ¶
type QueryStack ¶
type QueryStack struct { Output *elastic.BoolQuery // contains filtered or unexported fields }
func (*QueryStack) Compose ¶
func (qs *QueryStack) Compose(values []*Value) *Query
when ')' or end-of-input is encountered, we pop the whole group of individual queries from the stack back to the last '(' or start-of-input, and we inject into the parent bool query at proper bucket/nesting
func (*QueryStack) Current ¶
func (qs *QueryStack) Current() *Query
obtain a pointer to the "current" query
func (*QueryStack) Empty ¶
func (qs *QueryStack) Empty() bool
func (*QueryStack) Finalize ¶
func (qs *QueryStack) Finalize(values []*Value)
func (*QueryStack) Init ¶
func (qs *QueryStack) Init(defaultToOr bool)
func (*QueryStack) Pop ¶
func (qs *QueryStack) Pop() *Query
func (*QueryStack) Push ¶
func (qs *QueryStack) Push(negate bool)
type ValueStack ¶
type ValueStack struct { Default string // contains filtered or unexported fields }
func (*ValueStack) Boolean ¶
func (vs *ValueStack) Boolean(value string)
func (*ValueStack) Date ¶
func (vs *ValueStack) Date(filtered bool, value interface{})
takes RFC3339 datetime in UTC as string
func (*ValueStack) DateRangeOrMatchTerm ¶
func (vs *ValueStack) DateRangeOrMatchTerm(filtered bool, value string)
func (*ValueStack) Empty ¶
func (vs *ValueStack) Empty() bool
func (*ValueStack) Exists ¶
func (vs *ValueStack) Exists()
func (*ValueStack) Init ¶
func (vs *ValueStack) Init(defField string)
func (*ValueStack) Match ¶
func (vs *ValueStack) Match(text interface{})
func (*ValueStack) MatchTerm ¶
func (vs *ValueStack) MatchTerm(filtered bool, value string)
values should land in a "match" clause in query context, "term" clause in filter context
func (*ValueStack) Number ¶
func (vs *ValueStack) Number(filtered bool, value interface{})
func (*ValueStack) NumberRangeOrMatchTerm ¶
func (vs *ValueStack) NumberRangeOrMatchTerm(filtered bool, value string)
func (*ValueStack) Phrase ¶
func (vs *ValueStack) Phrase(phrase string)
only used in single-value (quoted phrase) context (i.e. not a KV)
func (*ValueStack) Pop ¶
func (vs *ValueStack) Pop() *Value
func (*ValueStack) PopGroup ¶
func (vs *ValueStack) PopGroup() []*Value
returns the group of values for this nested AND/OR block
func (*ValueStack) Push ¶
func (vs *ValueStack) Push(v *Value)
func (*ValueStack) Range ¶
func (vs *ValueStack) Range(value interface{})
func (*ValueStack) SetField ¶
func (vs *ValueStack) SetField(field string)
pop the tmp value stacked by SetNegation earlier, or produce new one if not - then fill in Field, replace on stack
func (*ValueStack) SetNegation ¶
func (vs *ValueStack) SetNegation()
first thing that happens in Term parsing (if present), so append a dummy value for filling in as we parse
func (*ValueStack) SetRangeOp ¶
func (vs *ValueStack) SetRangeOp(rop RangeOp)
pop the tmp value stacked by SetNegation and SetField, fill in range op, replace on stack
func (*ValueStack) StartGroup ¶
func (vs *ValueStack) StartGroup()
start sentinel for parens-nested groupings of AND/OR separated query elements TODO: move ValueStack into parent QueryStack instances to disambiguate this
func (*ValueStack) Term ¶
func (vs *ValueStack) Term(term interface{})
func (*ValueStack) Window ¶
func (vs *ValueStack) Window(fromTildaTo string)
TODO: this is hacky, separate out the number and date range handling