Documentation ¶
Index ¶
- Constants
- func EvaluateQuery(env utils.Environment, query *ContactQuery, queryable Queryable) (bool, error)
- func NewErrorListener() *errorListener
- type BoolCombination
- type BoolOperator
- type Condition
- type ContactQuery
- type QueryNode
- type Queryable
- type Visitor
- func (v *Visitor) Visit(tree antlr.ParseTree) interface{}
- func (v *Visitor) VisitCombinationAnd(ctx *gen.CombinationAndContext) interface{}
- func (v *Visitor) VisitCombinationImpicitAnd(ctx *gen.CombinationImpicitAndContext) interface{}
- func (v *Visitor) VisitCombinationOr(ctx *gen.CombinationOrContext) interface{}
- func (v *Visitor) VisitCondition(ctx *gen.ConditionContext) interface{}
- func (v *Visitor) VisitExpressionGrouping(ctx *gen.ExpressionGroupingContext) interface{}
- func (v *Visitor) VisitImplicitCondition(ctx *gen.ImplicitConditionContext) interface{}
- func (v *Visitor) VisitParse(ctx *gen.ParseContext) interface{}
- func (v *Visitor) VisitStringLiteral(ctx *gen.StringLiteralContext) interface{}
- func (v *Visitor) VisitTextLiteral(ctx *gen.TextLiteralContext) interface{}
Constants ¶
const (
ImplicitKey string = "*"
)
Variables ¶
This section is empty.
Functions ¶
func EvaluateQuery ¶
func EvaluateQuery(env utils.Environment, query *ContactQuery, queryable Queryable) (bool, error)
EvaluateQuery evaluates the given parsed query against a queryable object
func NewErrorListener ¶ added in v0.6.2
func NewErrorListener() *errorListener
Types ¶
type BoolCombination ¶
type BoolCombination struct {
// contains filtered or unexported fields
}
BoolCombination is a AND or OR combination of multiple conditions
func NewBoolCombination ¶
func NewBoolCombination(op BoolOperator, children ...QueryNode) *BoolCombination
NewBoolCombination creates a new boolean combination
func (*BoolCombination) Children ¶ added in v0.41.15
func (b *BoolCombination) Children() []QueryNode
Children returns the children of this boolean combination
func (*BoolCombination) Evaluate ¶
func (b *BoolCombination) Evaluate(env utils.Environment, queryable Queryable) (bool, error)
Evaluate returns whether this combination evaluates to true or false
func (*BoolCombination) Operator ¶ added in v0.41.15
func (b *BoolCombination) Operator() BoolOperator
Operator returns the type of boolean operator this combination is
func (*BoolCombination) String ¶
func (b *BoolCombination) String() string
type BoolOperator ¶ added in v0.41.15
type BoolOperator string
BoolOperator is a boolean operator (and or or)
const ( // BoolOperatorAnd is our constant for an AND operation BoolOperatorAnd BoolOperator = "and" // BoolOperatorOr is our constant for an OR operation BoolOperatorOr BoolOperator = "or" )
type Condition ¶
type Condition struct {
// contains filtered or unexported fields
}
Condition represents a comparison between a keywed value on the contact and a provided value
func (*Condition) Comparator ¶ added in v0.41.15
Comparator returns the type of comparison being made
type ContactQuery ¶
type ContactQuery struct {
// contains filtered or unexported fields
}
func ParseQuery ¶
func ParseQuery(text string) (*ContactQuery, error)
ParseQuery parses a ContactQL query from the given input
func (*ContactQuery) Evaluate ¶
func (q *ContactQuery) Evaluate(env utils.Environment, queryable Queryable) (bool, error)
func (*ContactQuery) Root ¶ added in v0.41.15
func (q *ContactQuery) Root() QueryNode
func (*ContactQuery) String ¶
func (q *ContactQuery) String() string
type Queryable ¶
type Queryable interface {
ResolveQueryKey(utils.Environment, string) []interface{}
}
Queryable is the interface objects must implement queried
type Visitor ¶
type Visitor struct {
gen.BaseContactQLVisitor
}
func (*Visitor) VisitCombinationAnd ¶
func (v *Visitor) VisitCombinationAnd(ctx *gen.CombinationAndContext) interface{}
expression : expression AND expression
func (*Visitor) VisitCombinationImpicitAnd ¶
func (v *Visitor) VisitCombinationImpicitAnd(ctx *gen.CombinationImpicitAndContext) interface{}
expression : expression expression
func (*Visitor) VisitCombinationOr ¶
func (v *Visitor) VisitCombinationOr(ctx *gen.CombinationOrContext) interface{}
expression : expression OR expression
func (*Visitor) VisitCondition ¶
func (v *Visitor) VisitCondition(ctx *gen.ConditionContext) interface{}
expression : TEXT COMPARATOR literal
func (*Visitor) VisitExpressionGrouping ¶
func (v *Visitor) VisitExpressionGrouping(ctx *gen.ExpressionGroupingContext) interface{}
expression : LPAREN expression RPAREN
func (*Visitor) VisitImplicitCondition ¶
func (v *Visitor) VisitImplicitCondition(ctx *gen.ImplicitConditionContext) interface{}
expression : TEXT
func (*Visitor) VisitParse ¶
func (v *Visitor) VisitParse(ctx *gen.ParseContext) interface{}
parse: expression
func (*Visitor) VisitStringLiteral ¶
func (v *Visitor) VisitStringLiteral(ctx *gen.StringLiteralContext) interface{}
literal : STRING
func (*Visitor) VisitTextLiteral ¶
func (v *Visitor) VisitTextLiteral(ctx *gen.TextLiteralContext) interface{}
literal : TEXT