contactql

package
v0.10.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2018 License: AGPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ImplicitKey string = "*"
)

Variables

This section is empty.

Functions

func EvaluateQuery

func EvaluateQuery(env utils.Environment, query *ContactQuery, queryable Queryable) (bool, error)

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 boolOp, children ...QueryNode) *BoolCombination

NewBoolCombination creates a new 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) String

func (b *BoolCombination) String() string

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) Evaluate

func (c *Condition) Evaluate(env utils.Environment, queryable Queryable) (bool, error)

Evaluate evaluates this condition against the queryable contact

func (*Condition) String

func (c *Condition) String() string

type ContactQuery

type ContactQuery struct {
	// contains filtered or unexported fields
}

func ParseQuery

func ParseQuery(text string) (*ContactQuery, error)

func (*ContactQuery) Evaluate

func (q *ContactQuery) Evaluate(env utils.Environment, queryable Queryable) (bool, error)

func (*ContactQuery) String

func (q *ContactQuery) String() string

type QueryNode

type QueryNode interface {
	fmt.Stringer

	Evaluate(utils.Environment, Queryable) (bool, error)
}

QueryNode is the base for nodes in our query parse tree

type Queryable

type Queryable interface {
	ResolveQueryKey(utils.Environment, string) []interface{}
}

type Visitor

type Visitor struct {
	gen.BaseContactQLVisitor
}

func NewVisitor

func NewVisitor() *Visitor

NewVisitor creates a new ContactQL visitor

func (*Visitor) Visit

func (v *Visitor) Visit(tree antlr.ParseTree) interface{}

Visit the top level parse tree

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL