Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractAllKeys(expression Expression) (out []string)
- func KeysApply(expr Expression, blockKeys KeysQuerier) bool
- func RoaringBitmapsApply(expr Expression, bitmaps map[string]*roaring64.Bitmap) *roaring64.Bitmap
- func TransformExpression(expr Expression, transformer FieldTransformer) error
- type AndExpression
- type DepthFirstVisitor
- func (v *DepthFirstVisitor) Visit_And(ctx context.Context, e *AndExpression) error
- func (v *DepthFirstVisitor) Visit_KeyTerm(ctx context.Context, e *KeyTerm) error
- func (v *DepthFirstVisitor) Visit_Not(ctx context.Context, e *NotExpression) error
- func (v *DepthFirstVisitor) Visit_Or(ctx context.Context, e *OrExpression) error
- func (v *DepthFirstVisitor) Visit_Parenthesis(ctx context.Context, e *ParenthesisExpression) error
- type Expression
- type FieldTransformer
- type HasChildrenExpression
- type KeyTerm
- type KeysQuerier
- type NotExpression
- type OnExpression
- type OrExpression
- type ParenthesisExpression
- type ParseError
- type Parser
- type StringLiteral
- type Visitor
Constants ¶
View Source
const MaxRecursionDeepness = 2501
MaxRecursionDeepness is the limit we impose on the number of direct ORs expression. It's possible to have more than that, just not in a single successive sequence or `1 or 2 or 3 ...`. This is to avoid first a speed problem where parsing start to be
Variables ¶
View Source
var ErrStopVisit = errors.New("stop")
View Source
var NoOpFieldTransformer noOpTransformer
Functions ¶
func ExtractAllKeys ¶
func ExtractAllKeys(expression Expression) (out []string)
FindAllFieldNames returns all used field names in the AST. There is **NO** ordering on the elements, i.e. they might not come in the same order specified in the AST.
func KeysApply ¶ added in v1.6.0
func KeysApply(expr Expression, blockKeys KeysQuerier) bool
func RoaringBitmapsApply ¶ added in v1.5.0
func TransformExpression ¶
func TransformExpression(expr Expression, transformer FieldTransformer) error
Types ¶
type AndExpression ¶
type AndExpression struct {
Children []Expression
}
func (*AndExpression) GetChildren ¶ added in v1.5.0
func (e *AndExpression) GetChildren() []Expression
type DepthFirstVisitor ¶
type DepthFirstVisitor struct {
// contains filtered or unexported fields
}
func NewDepthFirstVisitor ¶
func NewDepthFirstVisitor(beforeVisit, afterVisit OnExpression) *DepthFirstVisitor
func (*DepthFirstVisitor) Visit_And ¶
func (v *DepthFirstVisitor) Visit_And(ctx context.Context, e *AndExpression) error
func (*DepthFirstVisitor) Visit_KeyTerm ¶
func (v *DepthFirstVisitor) Visit_KeyTerm(ctx context.Context, e *KeyTerm) error
func (*DepthFirstVisitor) Visit_Not ¶
func (v *DepthFirstVisitor) Visit_Not(ctx context.Context, e *NotExpression) error
func (*DepthFirstVisitor) Visit_Or ¶
func (v *DepthFirstVisitor) Visit_Or(ctx context.Context, e *OrExpression) error
func (*DepthFirstVisitor) Visit_Parenthesis ¶
func (v *DepthFirstVisitor) Visit_Parenthesis(ctx context.Context, e *ParenthesisExpression) error
type Expression ¶
type FieldTransformer ¶
type FieldTransformer interface { // TransformFieldName receives the field name and allow receiver of the invocation to update its name. The field's // name is updated if the invocation returns a nil error. TransformFieldName(field string) (string, error) // TransformStringLiteral receives the field name (the updated one from a prior invocation of `TransformFieldName`) // and a string literal (either a direct one or a sub-element from a `StringList`) and allows transformation of the // `StringLiteral` value in place. TransformStringLiteral(field string, value *StringLiteral) error }
type HasChildrenExpression ¶ added in v1.5.0
type HasChildrenExpression interface {
GetChildren() []Expression
}
type KeyTerm ¶
type KeyTerm struct {
Value *StringLiteral
}
type KeysQuerier ¶ added in v1.6.0
type KeysQuerier struct {
// contains filtered or unexported fields
}
func NewFromIndexKeys ¶ added in v1.6.0
func NewFromIndexKeys(indexKeys *pbindex.Keys) KeysQuerier
type NotExpression ¶
type NotExpression struct {
Child Expression
}
type OnExpression ¶
type OnExpression func(ctx context.Context, expr Expression) error
type OrExpression ¶
type OrExpression struct {
Children []Expression
}
func (*OrExpression) GetChildren ¶ added in v1.5.0
func (e *OrExpression) GetChildren() []Expression
type ParenthesisExpression ¶
type ParenthesisExpression struct {
Child Expression
}
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type StringLiteral ¶
func (*StringLiteral) Literal ¶
func (e *StringLiteral) Literal() string
func (*StringLiteral) SetValue ¶
func (e *StringLiteral) SetValue(value string)
func (*StringLiteral) String ¶
func (e *StringLiteral) String() string
type Visitor ¶
type Visitor interface { Visit_And(ctx context.Context, expr *AndExpression) error Visit_Or(ctx context.Context, expr *OrExpression) error Visit_Parenthesis(ctx context.Context, expr *ParenthesisExpression) error Visit_Not(ctx context.Context, expr *NotExpression) error Visit_KeyTerm(ctx context.Context, expr *KeyTerm) error }
Click to show internal directories.
Click to hide internal directories.