Documentation
¶
Index ¶
- func IdentNeedsQuotes(ident string) bool
- func QuoteIdent(segments ...string) string
- func QuoteString(s string) string
- func ScanBareIdent(r io.RuneScanner) string
- func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error)
- func ScanString(r io.RuneScanner) (string, error)
- func Walk(v Visitor, expr Expr)
- func WalkFunc(e Expr, fn func(Expr))
- type BinaryExpr
- type BooleanLiteral
- type Call
- type Case
- type Distinct
- type Expr
- type GeopointLiteral
- type NullLiteral
- type NumberLiteral
- type ParenExpr
- type ParseError
- type Parser
- type Pos
- type Rewriter
- type Scanner
- type StringLiteral
- type Token
- type Type
- type UnaryExpr
- type UnknownLiteral
- type VarRef
- type Visitor
- type WhenThen
- type Wildcard
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdentNeedsQuotes ¶
IdentNeedsQuotes returns true if the ident string given would require quotes.
func QuoteIdent ¶
QuoteIdent returns a quoted identifier from multiple bare identifiers.
func ScanBareIdent ¶
func ScanBareIdent(r io.RuneScanner) string
ScanBareIdent reads bare identifier from a rune reader.
func ScanDelimited ¶
func ScanString ¶
func ScanString(r io.RuneScanner) (string, error)
ScanString reads a quoted string from a rune reader.
Types ¶
type BinaryExpr ¶
BinaryExpr represents an operation between two expressions.
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) String ¶
func (l *BooleanLiteral) String() string
String returns a string representation of the literal.
type Call ¶
Call represents a function call.
type Case ¶
Case represents a CASE WHEN .. THEN .. ELSE .. THEN expression.
type Distinct ¶
type Distinct struct { // Identifier following DISTINCT Val string }
Distinct represents a DISTINCT expression.
type Expr ¶
Expr represents an expression that can be evaluated to a value.
type GeopointLiteral ¶
type GeopointLiteral struct {
Val [2]float32
}
GeopointLiteral represents a literal for GeoPoint
func (*GeopointLiteral) String ¶
func (l *GeopointLiteral) String() string
String returns a string representation of the literal.
type NumberLiteral ¶
NumberLiteral represents a numeric literal.
func (*NumberLiteral) String ¶
func (l *NumberLiteral) String() string
String returns a string representation of the literal.
type ParenExpr ¶
ParenExpr represents a parenthesized expression.
type ParseError ¶
ParseError represents an error that occurred during parsing.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error returns the string representation of the error.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents an InfluxQL parser.
type Pos ¶
Pos specifies the line and character position of a token. The Char and Line are both zero-based indexes.
type Rewriter ¶
Rewriter can be called by Rewrite to replace nodes in the AST hierarchy. The Rewrite() function is called once per expression.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a lexical scanner for InfluxQL.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type StringLiteral ¶
type StringLiteral struct {
Val string
}
StringLiteral represents a string literal.
func (*StringLiteral) String ¶
func (l *StringLiteral) String() string
String returns a string representation of the literal.
type Token ¶
type Token int
Token is a lexical token of the InfluxQL language.
const ( // Special tokens ILLEGAL Token = iota EOF WS // Literals IDENT // main NUMBER // 12345.67 STRING // "abc" BADSTRING // "abc BADESCAPE // \q NULL // NULL UNKNOWN // UNKNOWN TRUE // true FALSE // false EXCLAMATION // ! UNARY_MINUS // - NOT // NOT BITWISE_NOT // ~0 // Date operators GET_WEEK_START GET_MONTH_START GET_QUARTER_START GET_YEAR_START GET_DAY_OF_MONTH GET_DAY_OF_YEAR GET_MONTH_OF_YEAR GET_QUARTER_OF_YEAR // hll operator GET_HLL_VALUE IS_NULL // IS NULL IS_NOT_NULL // IS NOT NULL IS_TRUE // IS TRUE IS_FALSE // IS FALSE ADD // + SUB // - MUL // * DIV // / MOD // % FLOOR // floor CONVERT_TZ // convert_tz BITWISE_AND // & BITWISE_OR // | BITWISE_XOR // ^ BITWISE_LEFT_SHIFT // << BITWISE_RIGHT_SHIFT // >> AND // AND OR // OR IN // IN NOT_IN // NOT_IN IS // IS NEQ // != // Do not modify the order of the following 5 operators EQ // = LT // < LTE // <= GT // > GTE // >= // Geo intersects GEOGRAPHY_INTERSECTS LPAREN // ( RPAREN // ) COMMA // , DOT // . // Keywords ALL AS ASC BEGIN BY CASE DEFAULT DELETE DESC DISTINCT DROP ELSE END EXISTS FIELD FOR FROM GROUP IF INF INNER INSERT KEY KEYS LIMIT OFFSET ON ORDER SELECT THEN TO VALUES WHEN WHERE WITH )
func (Token) MarshalJSON ¶
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator token.
type Type ¶
type Type int
Type defines data types for expression evaluation. Expression types are determined at query compilation time, type castings are generated when apprioperiate. Notice that word widths are not specified here.
func (Type) MarshalJSON ¶
type UnaryExpr ¶
UnaryExpr represents an operation on a single expression.
type VarRef ¶
type VarRef struct { Val string ExprType Type // ID of the table in the query scope (0 for the main table, 1+ for foreign // tables). TableID int // ID of the column in the schema. ColumnID int // Enum dictionary for enum typed column. Can only be accessed while holding // the schema lock. EnumDict map[string]int `json:"-"` // Setting enum reverse dict requires holding the schema lock, // while reading from it does not require holding the schema lock. EnumReverseDict []string `json:"-"` DataType memCom.DataType }
VarRef represents a reference to a variable.
type Visitor ¶
Visitor can be called by Walk to traverse an AST hierarchy. The Visit() function is called once per expression.