transpiler

package
v0.0.0-...-31263be Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LEFT_EXPR = iota + 1
	RIGHT_EXPR
)
View Source
const (
	POW = "pow"
)

Variables

View Source
var (
	ErrPromExprNotSupported = errors.New("unsupported expression")
)
View Source
var YieldsFloat = yieldsFloat

Functions

This section is empty.

Types

type Condition

type Condition influxql.BinaryExpr

func (*Condition) And

func (receiver *Condition) And(expr *influxql.BinaryExpr) *Condition

func (*Condition) Or

func (receiver *Condition) Or(expr *influxql.BinaryExpr) *Condition

type Transpiler

type Transpiler struct {
	models.PromCommand
	// contains filtered or unexported fields
}

Transpiler is responsible for transpiling a single PromQL expression to InfluxQL expression. It will be gc-ed after its work done.

func (*Transpiler) NewBinaryCallExpr

func (t *Transpiler) NewBinaryCallExpr(opFn string, lhs, rhs influxql.Expr) influxql.Expr

NewBinaryCallExpr creates a pointer to influxql.Call

func (*Transpiler) NewBinaryExpr

func (t *Transpiler) NewBinaryExpr(op influxql.Token, lhs, rhs influxql.Expr) influxql.Expr

NewBinaryExpr creates a pointer to influxql.BinaryExpr

func (*Transpiler) Transpile

func (t *Transpiler) Transpile(expr parser.Expr) (influxql.Node, error)

Transpile converts a PromQL expression with the time ranges set in the transpiler into an InfluxQL expression. The resulting InfluxQL expression can be executed and the result needs to be transformed using InfluxResultToPromQLValue() (implemented in the promql package of this repo) to get a result value that is fully equivalent to the result of a native PromQL execution.

During the transpiling procedure, the transpiler recursively translates the PromQL AST into equivalent InfluxQL AST.

Jump to

Keyboard shortcuts

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