temql

package
v0.0.0-...-dc2a067 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

func ParseExpr

func ParseExpr(input string) interface{}

func ParseLabels

func ParseLabels(input string) (labels.Labels, error)

func ParseMetric

func ParseMetric(input string) (m labels.Labels, err error)

Types

type Expr

type Expr interface {
	Node
}

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 ItemType

type ItemType int

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 Pos

type Pos int

type PositionRange

type PositionRange struct {
	Start Pos
	End   Pos
}

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 TermExpr

type TermExpr struct {
	Name string
}

func (*TermExpr) String

func (t *TermExpr) String() string

type VectorSelector

type VectorSelector struct {
	Name string

	Expr Expr

	LabelMatchers []*prompb.LabelMatcher
}

func (*VectorSelector) String

func (*VectorSelector) String() string

Jump to

Keyboard shortcuts

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