ast

package
v0.0.0-...-5ab8b7a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalIsEmpty

func EvalIsEmpty(expr Expr, data map[string]interface{}) (bool, error)

func Inspect

func Inspect(walker ExprWalker, f func(Expr) bool)

Types

type BinaryExpr

type BinaryExpr struct {
	Op  Operator
	LHS Expr
	RHS Expr
}

func (*BinaryExpr) Eval

func (expr *BinaryExpr) Eval(data map[string]interface{}) (val interface{}, err error)

func (*BinaryExpr) Walk

func (expr *BinaryExpr) Walk(v Visitor) Expr

type Boolean

type Boolean struct {
	Val bool
}

func (*Boolean) Eval

func (expr *Boolean) Eval(data map[string]interface{}) (interface{}, error)

func (*Boolean) Walk

func (expr *Boolean) Walk(v Visitor) Expr

type Expr

type Expr interface {
	ExprWalker
	Eval(data map[string]interface{}) (interface{}, error)
}

type ExprWalker

type ExprWalker interface {
	Walk(Visitor) Expr
}

type Float

type Float struct {
	Val float64
}

func (*Float) Eval

func (expr *Float) Eval(data map[string]interface{}) (interface{}, error)

func (*Float) Walk

func (expr *Float) Walk(v Visitor) Expr

type FromClause

type FromClause struct {
	Subselects []*FromSubselect
	Resources  []*FromResource
}

type FromResource

type FromResource struct {
	Alias   string
	Group   string
	Version string
	Kind    string

	Namespace string
}

type FromSubselect

type FromSubselect struct {
	Alias  string
	Select *SelectStatement
}

type Integer

type Integer struct {
	Val int
}

func (*Integer) Eval

func (expr *Integer) Eval(data map[string]interface{}) (interface{}, error)

func (*Integer) Walk

func (expr *Integer) Walk(v Visitor) Expr

type JQ

type JQ struct {
	Expr     Expr
	Path     string
	PathExpr *PathExpression
}

func (*JQ) Eval

func (expr *JQ) Eval(data map[string]interface{}) (interface{}, error)

func (*JQ) Walk

func (expr *JQ) Walk(v Visitor) Expr

type JsonPath

type JsonPath struct {
	Expr     Expr
	Path     string
	PathExpr *PathExpression
}

func (*JsonPath) Eval

func (expr *JsonPath) Eval(data map[string]interface{}) (interface{}, error)

func (*JsonPath) Walk

func (expr *JsonPath) Walk(v Visitor) Expr

type Operator

type Operator lexer.TokenType

func (Operator) IsOperator

func (o Operator) IsOperator() bool

func (Operator) Precedence

func (o Operator) Precedence() int

type ParenExpr

type ParenExpr struct {
	Expr     Expr
	PathExpr *PathExpression
}

func (*ParenExpr) Eval

func (expr *ParenExpr) Eval(data map[string]interface{}) (interface{}, error)

func (*ParenExpr) Walk

func (expr *ParenExpr) Walk(v Visitor) Expr

type PathExpression

type PathExpression struct {
	Fields []string
}

type Reference

type Reference struct {
	Name     string
	PathExpr *PathExpression
}

func (*Reference) Eval

func (expr *Reference) Eval(data map[string]interface{}) (interface{}, error)

func (*Reference) Walk

func (expr *Reference) Walk(v Visitor) Expr

type SelectClause

type SelectClause struct {
	Expressions []*SelectExpression
}

func (*SelectClause) Walk

func (stmt *SelectClause) Walk(v Visitor) Expr

type SelectExpression

type SelectExpression struct {
	Alias     string
	Condition Expr
}

type SelectStatement

type SelectStatement struct {
	SelectClause *SelectClause
	FromClause   *FromClause
	WhereClause  *WhereClause
}

type String

type String struct {
	Val string
}

func (*String) Eval

func (expr *String) Eval(data map[string]interface{}) (interface{}, error)

func (*String) Walk

func (expr *String) Walk(v Visitor) Expr

type Subselect

type Subselect struct {
	Select *SelectStatement

	SelectEval func(map[string]interface{}) (interface{}, error)
}

func (*Subselect) Eval

func (expr *Subselect) Eval(data map[string]interface{}) (interface{}, error)

func (*Subselect) Walk

func (expr *Subselect) Walk(v Visitor) Expr

type Visitor

type Visitor interface {
	Visit(Expr) Visitor
}

type WhereClause

type WhereClause struct {
	Condition Expr
}

func (*WhereClause) Walk

func (stmt *WhereClause) Walk(v Visitor) Expr

Jump to

Keyboard shortcuts

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