Documentation ¶
Overview ¶
Code generated by goyacc -l -o gram_y.go gram.y. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func Init()
- type Anonymous
- type AttrExpr
- type BinaryExpr
- type BoolLiteral
- type CascadeFunctions
- type DFQuery
- type DeleteFunc
- type ESTRes
- type Evaluable
- type Expr
- type Fill
- type FuncArg
- type FuncArgList
- type FuncExpr
- type GroupBy
- type Helper
- type Identifier
- type Item
- type ItemType
- type KVs
- type Lexer
- type Limit
- type NilLiteral
- type Node
- type NodeList
- type NumberLiteral
- type Offset
- type OrderBy
- type OrderByElem
- type OrderType
- type OuterFunc
- type OuterFuncs
- type ParenExpr
- type ParseError
- type ParseErrors
- type Pos
- type PositionRange
- type Regex
- type SLimit
- type SOffset
- type SearchAfter
- type Star
- type Statement
- type StaticCast
- type Stmts
- type StringLiteral
- type Target
- type TimeResolution
- type TimeZone
- type Value
- type ValueType
- type WhereCondition
- type WhereConditions
Constants ¶
View Source
const ( FillNil int = iota + 1 FillInt FillFloat FillStr FillLinear FillPrevious )
View Source
const ( Digits = "0123456789" HexDigits = "0123456789abcdefABCDEF" )
View Source
const ADD = 57368
View Source
const AND = 57394
View Source
const AS = 57381
View Source
const ASC = 57382
View Source
const AUTO = 57383
View Source
const BY = 57384
View Source
const COLON = 57347
View Source
const COMMA = 57349
View Source
const COMMENT = 57350
View Source
const DESC = 57387
View Source
const DIV = 57369
View Source
const DOT = 57366
View Source
const DURATION = 57351
View Source
const EOF = 57352
View Source
const EQ = 57346
View Source
const ERROR = 57353
View Source
const FALSE = 57389
View Source
const FILTER = 57390
View Source
const FLOAT = 57406
View Source
const GT = 57371
View Source
const GTE = 57370
View Source
const ID = 57354
View Source
const IDENTIFIER = 57391
View Source
const IN = 57392
View Source
const INT = 57405
View Source
const LEFT_BRACE = 57355
View Source
const LEFT_BRACKET = 57356
View Source
const LEFT_PAREN = 57357
View Source
const LIMIT = 57396
View Source
const LINK = 57395
View Source
const LT = 57372
View Source
const LTE = 57373
View Source
const MATCH = 57385
View Source
const MOD = 57374
View Source
const MUL = 57375
View Source
const NAMESPACE = 57365
View Source
const NEQ = 57376
View Source
const NIL = 57399
View Source
const NOT_IN = 57393
View Source
const NOT_MATCH = 57386
View Source
const NULL = 57400
View Source
const NUMBER = 57358
View Source
const (
Nil = "nil"
)
View Source
const OFFSET = 57401
View Source
const OR = 57398
View Source
const ORDER = 57403
View Source
const POINT = 57407
View Source
const POW = 57377
View Source
const QUOTED_STRING = 57364
View Source
const RE = 57404
View Source
const RIGHT_BRACE = 57359
View Source
const RIGHT_BRACKET = 57360
View Source
const RIGHT_PAREN = 57361
View Source
const SEMICOLON = 57348
View Source
const SLIMIT = 57397
View Source
const SOFFSET = 57402
View Source
const SPACE = 57362
View Source
const START_BINARY_EXPRESSION = 57413
View Source
const START_FUNC_EXPRESSION = 57414
View Source
const START_STMTS = 57412
View Source
const START_WHERE_CONDITION = 57415
View Source
const STRING = 57363
View Source
const SUB = 57378
View Source
const TIMEZONE = 57408
View Source
const TRUE = 57388
View Source
const WITH = 57409
Variables ¶
View Source
var (
ItemTypeStr = map[ItemType]string{
LEFT_PAREN: "(",
RIGHT_PAREN: ")",
LEFT_BRACE: "{",
RIGHT_BRACE: "}",
LEFT_BRACKET: "[",
RIGHT_BRACKET: "]",
COMMA: ",",
EQ: "=",
COLON: ":",
SEMICOLON: ";",
SPACE: "<space>",
DOT: ".",
NAMESPACE: "::",
SUB: "-",
ADD: "+",
MUL: "*",
MOD: "%",
DIV: "/",
NEQ: "!=",
LTE: "<=",
LT: "<",
GTE: ">=",
GT: ">",
POW: "^",
AND: "&&",
OR: "||",
}
)
Functions ¶
Types ¶
type Anonymous ¶
type Anonymous struct{}
func (*Anonymous) Pos ¶
func (n *Anonymous) Pos() *PositionRange
type BinaryExpr ¶
type BinaryExpr struct { Op ItemType `json:"operator,omitempty"` LHS Node `json:"left,omitempty"` RHS Node `json:"right,omitempty"` ReturnBool bool `json:"-"` }
func (*BinaryExpr) DQLExpr ¶
func (e *BinaryExpr) DQLExpr()
func (*BinaryExpr) Eval ¶
func (e *BinaryExpr) Eval(data KVs) bool
func (*BinaryExpr) Pos ¶
func (e *BinaryExpr) Pos() *PositionRange
func (*BinaryExpr) String ¶
func (e *BinaryExpr) String() string
func (*BinaryExpr) Type ¶
func (e *BinaryExpr) Type() ValueType
type BoolLiteral ¶
type BoolLiteral struct {
Val bool `json:"val,omitempty"`
}
func (*BoolLiteral) Pos ¶
func (n *BoolLiteral) Pos() *PositionRange
func (*BoolLiteral) String ¶
func (n *BoolLiteral) String() string
type CascadeFunctions ¶
type CascadeFunctions struct {
Funcs []*FuncExpr `json:"function_list,omitempty"`
}
func (*CascadeFunctions) Pos ¶
func (n *CascadeFunctions) Pos() *PositionRange
func (*CascadeFunctions) String ¶
func (n *CascadeFunctions) String() string
type DFQuery ¶
type DFQuery struct { // data source Names []string `json:"names,omitempty"` RegexNames []*Regex `json:"regex_names,omitempty"` Targets []*Target `json:"targets,omitempty"` WhereCondition []Node `json:"where_condition,omitempty"` Namespace string `json:"namespace,omitempty"` Subquery *DFQuery `json:"subquery,omitempty"` GroupBy *GroupBy `json:"groupby,omitempty"` OrderBy *OrderBy `json:"orderby,omitempty"` Limit *Limit `json:"limit,omitempty"` Offset *Offset `json:"offset,omitempty"` SLimit *SLimit `json:"slimit,omitempty"` SOffset *SOffset `json:"soffset,omitempty"` TimeZone *TimeZone `json:"timezone,omitempty"` SearchAfter *SearchAfter `json:"search_after,omitempty"` // search_after Helper *Helper `json:"-"` Anonymous bool `json:"-"` Highlight bool `json:"highlight,omitempty"` }
func (*DFQuery) GroupByList ¶
func (*DFQuery) IsAllTargets ¶
IsAllTargets 未指定 target 或为手动填写 "*",即 ALL,like SELECT * FROM XX.
func (*DFQuery) IsMatchTargetsNum ¶
func (*DFQuery) Pos ¶
func (m *DFQuery) Pos() *PositionRange
type DeleteFunc ¶
type DeleteFunc struct { // (1) dql语句; // (2) es indexName, 索引名称不包含wsid,例如: rum, log等; // (3) influxdb measurement name, 例如: cpu,mem等 StrDql string Func *FuncExpr DeleteIndex bool // 是否删除整个ES索引 DeleteMeasurement bool // 是否删除整个Influxdb measurement }
DeleteFunc delete info.
func (*DeleteFunc) Pos ¶
func (d *DeleteFunc) Pos() *PositionRange
func (*DeleteFunc) String ¶
func (d *DeleteFunc) String() string
type ESTRes ¶
type ESTRes struct { Alias map[string]string // 别名信息 SortFields []string // 返回字段有序列表 ClassNames string // metric 类型名称 Show bool // 是否是show查询 ShowFields bool // 是否是show fields查询 TimeField string // time字段 FLFuncCount int // first,last函数个数 AggsFromSize int // 聚合的分页 StartTime int64 // 开始时间 EndTime int64 // 结束时间 HighlightFields []string // 高亮字段 }
type Fill ¶
type Fill struct { FillType int `json:"-"` Str string `json:"-"` Float float64 `json:"-"` Int int64 `json:"-"` Boolean bool `json:"-"` }
func (*Fill) MarshalJSON ¶
func (*Fill) Pos ¶
func (n *Fill) Pos() *PositionRange
func (*Fill) StringInfluxql ¶
type FuncArgList ¶
type FuncArgList []Node
func (FuncArgList) Pos ¶
func (n FuncArgList) Pos() *PositionRange
func (FuncArgList) String ¶
func (n FuncArgList) String() string
type GroupBy ¶
type GroupBy struct {
List NodeList `json:"val_list,omitempty"`
}
func (*GroupBy) ColumnList ¶
func (*GroupBy) Pos ¶
func (n *GroupBy) Pos() *PositionRange
type Helper ¶
type Helper struct {
ESTResPtr *ESTRes // es translate,当结果转为influxdb结构使用
}
Helper tranlate中间结果.
type Identifier ¶
type Identifier struct {
Name string `json:"val,omitempty"`
}
func (*Identifier) DQLExpr ¶
func (e *Identifier) DQLExpr()
func (*Identifier) Pos ¶
func (e *Identifier) Pos() *PositionRange
func (*Identifier) String ¶
func (e *Identifier) String() string
func (*Identifier) Type ¶
func (e *Identifier) Type() ValueType
type Item ¶
func (*Item) PositionRange ¶
func (i *Item) PositionRange() *PositionRange
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer holds the state of the scanner.
type Limit ¶
type Limit struct {
Limit int64 `json:"val,omitempty"`
}
func (*Limit) Pos ¶
func (n *Limit) Pos() *PositionRange
type NilLiteral ¶
type NilLiteral struct{}
func (*NilLiteral) Pos ¶
func (n *NilLiteral) Pos() *PositionRange
func (*NilLiteral) String ¶
func (n *NilLiteral) String() string
type Node ¶
type Node interface { String() string Pos() *PositionRange }
type NumberLiteral ¶
func (*NumberLiteral) DQLExpr ¶
func (e *NumberLiteral) DQLExpr()
func (*NumberLiteral) IsPositiveInteger ¶
func (e *NumberLiteral) IsPositiveInteger() bool
func (*NumberLiteral) MarshalJSON ¶
func (e *NumberLiteral) MarshalJSON() ([]byte, error)
func (*NumberLiteral) Pos ¶
func (e *NumberLiteral) Pos() *PositionRange
func (*NumberLiteral) Reverse ¶
func (e *NumberLiteral) Reverse()
func (*NumberLiteral) String ¶
func (e *NumberLiteral) String() string
func (*NumberLiteral) Type ¶
func (e *NumberLiteral) Type() ValueType
type Offset ¶
type Offset struct {
Offset int64 `json:"val,omitempty"`
}
func (*Offset) Pos ¶
func (n *Offset) Pos() *PositionRange
type OrderBy ¶
type OrderBy struct {
List NodeList
}
func (*OrderBy) Pos ¶
func (n *OrderBy) Pos() *PositionRange
type OrderByElem ¶
func (*OrderByElem) MarshalJSON ¶
func (n *OrderByElem) MarshalJSON() ([]byte, error)
func (*OrderByElem) Pos ¶
func (n *OrderByElem) Pos() *PositionRange
func (*OrderByElem) String ¶
func (n *OrderByElem) String() string
type OuterFunc ¶
type OuterFunc struct { Func *FuncExpr `json:"func,omitempty"` FuncArgVals []interface{} `json:"func_arg_vals,omitempty"` FuncArgTypes []string `json:"func_arg_types,omitempty"` FuncArgNames []string `json:"func_arg_names,omitempty"` }
OuterFunc outerFunc.
func (*OuterFunc) Pos ¶
func (ofuncs *OuterFunc) Pos() *PositionRange
type OuterFuncs ¶
type OuterFuncs struct {
Funcs []*OuterFunc `json:"funcs,omitempty"`
}
func (*OuterFuncs) JSON ¶
func (ofuncs *OuterFuncs) JSON() ([]byte, error)
func (*OuterFuncs) Pos ¶
func (ofuncs *OuterFuncs) Pos() *PositionRange
func (*OuterFuncs) String ¶
func (ofuncs *OuterFuncs) String() string
type ParenExpr ¶
type ParenExpr struct {
Param Node `json:"paren"`
}
func (*ParenExpr) Pos ¶
func (*ParenExpr) Pos() *PositionRange
type ParseError ¶
type ParseError struct { Pos *PositionRange Err error Query string LineOffset int }
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ParseErrors ¶
type ParseErrors []ParseError
type Pos ¶
type Pos int
Pos is the position in a string. Negative numbers indicate undefined positions.
type PositionRange ¶
type PositionRange struct {
Start, End Pos
}
type SLimit ¶
type SLimit struct {
SLimit int64 `json:"val,omitempty"`
}
func (*SLimit) Pos ¶
func (n *SLimit) Pos() *PositionRange
type SOffset ¶
type SOffset struct {
SOffset int64 `json:"val,omitempty"`
}
func (*SOffset) Pos ¶
func (n *SOffset) Pos() *PositionRange
type SearchAfter ¶
type SearchAfter struct {
Vals []interface{} `json:"vals,omitempty"`
}
SearchAfter 深度分页.
type Star ¶
type Star struct{}
func (*Star) MarshalJSON ¶
func (*Star) Pos ¶
func (n *Star) Pos() *PositionRange
type StaticCast ¶
type StaticCast struct { IsInt bool IsFloat bool Val *Identifier }
func (*StaticCast) DQLExpr ¶
func (e *StaticCast) DQLExpr()
func (*StaticCast) MarshalJSON ¶
func (e *StaticCast) MarshalJSON() ([]byte, error)
func (*StaticCast) Pos ¶
func (e *StaticCast) Pos() *PositionRange
func (*StaticCast) String ¶
func (e *StaticCast) String() string
func (*StaticCast) Type ¶
func (e *StaticCast) Type() ValueType
type StringLiteral ¶
type StringLiteral struct {
Val string `json:"val,omitempty"`
}
func (*StringLiteral) DQLExpr ¶
func (e *StringLiteral) DQLExpr()
func (*StringLiteral) Pos ¶
func (e *StringLiteral) Pos() *PositionRange
func (*StringLiteral) String ¶
func (e *StringLiteral) String() string
func (*StringLiteral) Type ¶
func (e *StringLiteral) Type() ValueType
type Target ¶
type Target struct { Col Node `json:"col,omitempty"` Alias string `json:"alias,omitempty"` Fill *Fill `json:"fill,omitempty"` Talias string `json:"tailas,omitempty"` // dql翻译别名 }
func (*Target) Pos ¶
func (n *Target) Pos() *PositionRange
type TimeResolution ¶
type TimeResolution struct { Duration time.Duration Auto bool PointNum *NumberLiteral }
func (*TimeResolution) Pos ¶
func (n *TimeResolution) Pos() *PositionRange
func (*TimeResolution) String ¶
func (n *TimeResolution) String() string
type WhereCondition ¶
type WhereCondition struct {
// contains filtered or unexported fields
}
func (*WhereCondition) Eval ¶
func (x *WhereCondition) Eval(data KVs) bool
func (*WhereCondition) Pos ¶
func (x *WhereCondition) Pos() *PositionRange
func (*WhereCondition) String ¶
func (x *WhereCondition) String() string
type WhereConditions ¶
type WhereConditions []Node
func GetConds ¶
func GetConds(input string) (WhereConditions, error)
func (WhereConditions) Eval ¶
func (x WhereConditions) Eval(data KVs) int
func (WhereConditions) Pos ¶
func (x WhereConditions) Pos() *PositionRange
func (WhereConditions) String ¶
func (x WhereConditions) String() string
Click to show internal directories.
Click to hide internal directories.