Documentation ¶
Index ¶
- Constants
- Variables
- func ParseExpr(input string) interface{}
- func ParseLabels(input string) (labels.Labels, error)
- func ParseMetric(input string) (m labels.Labels, err error)
- type Expr
- type Item
- type ItemType
- type Node
- type ParseErr
- type ParseErrors
- type Pos
- type PositionRange
- type TermBinaryExpr
- type TermExpr
- type VectorSelector
Constants ¶
View Source
const COMMA = 57358
View Source
const EOF = 57360
View Source
const EQL = 57354
View Source
const ERROR = 57359
View Source
const IDENTIFIER = 57355
View Source
const LAND = 57352
View Source
const LEFT_BRACE = 57350
View Source
const LEFT_PAREN = 57348
View Source
const LOR = 57353
View Source
const METRIC_IDENTIFIER = 57357
View Source
const RIGHT_BRACE = 57351
View Source
const RIGHT_PAREN = 57349
View Source
const START_EXPRESSION = 57347
View Source
const START_METRIC = 57346
View Source
const STRING = 57356
Variables ¶
View Source
var ItemTypeStr = map[ItemType]string{
LEFT_PAREN: "(",
RIGHT_PAREN: ")",
LEFT_BRACE: "{",
RIGHT_BRACE: "}",
EQL: "=",
COMMA: ",",
}
符号定义
Functions ¶
Types ¶
type Item ¶
type Item struct { Typ ItemType // The type of this Item. Pos Pos // The starting position, in bytes, of this Item in the input string. Val string // The value of this Item. }
Item represents a token or text string returned from the scanner.
func (*Item) PositionRange ¶
func (i *Item) PositionRange() PositionRange
Item implements the Node interface. This makes it possible to call mergeRanges on them.
type Node ¶
type Node interface { // String representation of the node that returns the given node when parsed // as part of a valid query. String() string }
type ParseErr ¶
type ParseErr struct { PositionRange PositionRange Err error Query string // LineOffset is an additional line offset to be added. Only used inside unit tests. LineOffset int }
ParseErr wraps a parsing error with line and position context.
type ParseErrors ¶
type ParseErrors []ParseErr
type PositionRange ¶
PositionRange describes a position in the input string of the parser.
type TermBinaryExpr ¶
type TermBinaryExpr struct { Op ItemType // The operation of the expression. LHS, RHS Expr // The operands on the respective sides of the operator. }
func (*TermBinaryExpr) Print ¶
func (t *TermBinaryExpr) Print()
func (*TermBinaryExpr) String ¶
func (t *TermBinaryExpr) String() string
type VectorSelector ¶
type VectorSelector struct { Name string Expr Expr LabelMatchers []*prompb.LabelMatcher }
func (*VectorSelector) String ¶
func (*VectorSelector) String() string
Click to show internal directories.
Click to hide internal directories.