Documentation ¶
Overview ¶
Package conditions package offers a parser of a simple conditions specification language (reduced set of arithmetic/logical operations). It was created for Flow-Based Programming components that require configuration to perform some operations on the data received from multiple input ports.
Index ¶
- Constants
- func Evaluate(expr Expr, args map[string]interface{}) (bool, error)
- func FormatDuration(d time.Duration) string
- func Quote(s string) string
- func QuoteIdent(s string) string
- func Variables(expression Expr) []string
- func Walk(v Visitor, node Node)
- func WalkFunc(node Node, fn func(Node))
- type BinaryExpr
- type BooleanLiteral
- type DataType
- type DurationLiteral
- type Expr
- type Node
- type NumberLiteral
- type ParenExpr
- type Parser
- type SliceNumberLiteral
- type SliceStringLiteral
- type StringLiteral
- type TimeLiteral
- type Token
- type VarRef
- type Visitor
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶
FormatDuration formats a duration to a string.
func QuoteIdent ¶
QuoteIdent returns a quoted identifier if the identifier requires quoting. Otherwise returns the original string passed in.
Types ¶
type BinaryExpr ¶
BinaryExpr represents an operation between two expressions.
func (*BinaryExpr) Args ¶
func (e *BinaryExpr) Args() []string
func (*BinaryExpr) String ¶
func (e *BinaryExpr) String() string
String returns a string representation of the binary expression.
type BooleanLiteral ¶
type BooleanLiteral struct {
Val bool
}
BooleanLiteral represents a boolean literal.
func (*BooleanLiteral) Args ¶
func (l *BooleanLiteral) Args() []string
func (*BooleanLiteral) String ¶
func (l *BooleanLiteral) String() string
String returns a string representation of the literal.
type DataType ¶
type DataType string
DataType represents the primitive data types available in InfluxQL.
func InspectDataType ¶
func InspectDataType(v interface{}) DataType
InspectDataType returns the data type of a given value.
type DurationLiteral ¶
DurationLiteral represents a duration literal.
func (*DurationLiteral) String ¶
func (l *DurationLiteral) String() string
String returns a string representation of the literal.
type Node ¶
type Node interface { String() string // contains filtered or unexported methods }
Node represents a node in the conditions abstract syntax tree.
type NumberLiteral ¶
type NumberLiteral struct {
Val float64
}
NumberLiteral represents a numeric literal.
func (*NumberLiteral) Args ¶
func (n *NumberLiteral) Args() []string
func (*NumberLiteral) String ¶
func (l *NumberLiteral) String() string
String returns a string representation of the literal.
type ParenExpr ¶
type ParenExpr struct {
Expr Expr
}
ParenExpr represents a parenthesized expression.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser encapsulates the scanner and responsible for returning AST composed from statements read from a given reader.
type SliceNumberLiteral ¶
type SliceNumberLiteral struct {
Val []float64
}
func (*SliceNumberLiteral) Args ¶
func (l *SliceNumberLiteral) Args() []string
func (*SliceNumberLiteral) String ¶
func (l *SliceNumberLiteral) String() string
String returns a string representation of the literal.
type SliceStringLiteral ¶
type SliceStringLiteral struct {
Val []string
}
func (*SliceStringLiteral) Args ¶
func (l *SliceStringLiteral) Args() []string
func (*SliceStringLiteral) String ¶
func (l *SliceStringLiteral) String() string
String returns a string representation of the literal.
type StringLiteral ¶
type StringLiteral struct {
Val string
}
StringLiteral represents a string literal.
func (*StringLiteral) Args ¶
func (l *StringLiteral) Args() []string
func (*StringLiteral) String ¶
func (l *StringLiteral) String() string
String returns a string representation of the literal.
type TimeLiteral ¶
TimeLiteral represents a point-in-time literal.
func (*TimeLiteral) String ¶
func (l *TimeLiteral) String() string
String returns a string representation of the literal.
type Token ¶
type Token int
Token represents a lexical token.
const ( // ILLEGAL token represent illegal token found in the statement ILLEGAL Token = iota // EOF token represents end of statement EOF IDENT // Variable references $0, $5, etc NUMBER // 12345.67 STRING // "abc" ARRAY // array of values (string or number) ["a","b","c"] [342,4325,6,4] TRUE // true FALSE // false AND // AND OR // OR EQ // = NEQ // != LT // < LTE // <= GT // > GTE // >= NAND // NAND XOR // XOR EREG // =~ NEREG // !~ IN // IN NOTIN // NOT IN INTERSECTS // INTERSECTS (two sets has not empty intersect) HAS // HAS (element contains at set as left operand) LPAREN // ( RPAREN // ) )
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator token.