parse

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpEqual              = Operator("=")
	OpNotEqual           = Operator("!=")
	OpContains           = Operator(":")
	OpExists             = Operator(":*")
	OpGreaterThan        = Operator(">")
	OpGreaterOrEqualThan = Operator(">=")
	OpLessThan           = Operator("<")
	OpLessOrEqualThan    = Operator("<=")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AndNode

type AndNode struct {
	NodeType
	Nodes []*ExprNode
}

func Parse

func Parse(query string) (root *AndNode, err error)

func (*AndNode) String

func (a *AndNode) String() string

type ConstantNode

type ConstantNode struct {
	NodeType
	Name string
}

func (*ConstantNode) String

func (c *ConstantNode) String() string

type ExprNode

type ExprNode struct {
	NodeType
	Field    *FieldNode
	Op       *OperatorNode
	Val      Node
	Negative bool
}

func (ExprNode) String

func (e ExprNode) String() string

type FieldNode

type FieldNode struct {
	NodeType
	Name string
}

func (*FieldNode) String

func (f *FieldNode) String() string

type Node

type Node interface {
	Type() NodeType
	String() string
}

type NodeType

type NodeType int
const (
	NodeField NodeType = iota
	NodeOperator
	NodeString
	NodeNumber
	NodeConstant
	NodeAnd
	NodeExpr
)

func (NodeType) Type

func (t NodeType) Type() NodeType

type NumberNode

type NumberNode struct {
	NodeType
	Val int64
}

func (*NumberNode) String

func (n *NumberNode) String() string

type Operator

type Operator string

func (Operator) HasArg added in v0.4.0

func (op Operator) HasArg() bool

type OperatorNode

type OperatorNode struct {
	NodeType
	Val Operator
}

func (*OperatorNode) String

func (f *OperatorNode) String() string

type StringNode

type StringNode struct {
	NodeType
	Quoted string
}

func (*StringNode) String

func (s *StringNode) String() string

func (*StringNode) Unquoted added in v0.4.0

func (s *StringNode) Unquoted() string

Jump to

Keyboard shortcuts

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