expressions

package
v0.0.0-...-35c18bc Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LITERAL_EXPRESSION = "literal"

Variables

View Source
var DefaultFactory = Factory{}

Functions

func ContextWithInputs

func ContextWithInputs(ctx context.Context, inputs ...interface{}) context.Context

func InputsFromContext

func InputsFromContext(ctx context.Context) []interface{}

func ResolveArg

func ResolveArg(ctx context.Context, arg interface{}) (interface{}, error)

func ResolveArgs

func ResolveArgs(ctx context.Context, args ...interface{}) ([]interface{}, error)

func StringifyArgs

func StringifyArgs(args []interface{}) string

func StringifyExpression

func StringifyExpression(expression Expression) string

func StringifyValue

func StringifyValue(val interface{}) string

Types

type Abs

type Abs struct{}

Abs

Syntax

["abs", value]: int

func (Abs) Exec

func (Abs) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Abs) Len

func (Abs) Len() int

func (Abs) Names

func (Abs) Names() []string

type Add

type Add struct{}

Add

Syntax

["add", value, value]: int

func (Add) Exec

func (Add) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Add) Len

func (Add) Len() int

func (Add) Names

func (Add) Names() []string

type All

type All struct{}

All

Syntax

["all", ...]: bool

func (All) Exec

func (All) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (All) Len

func (All) Len() int

func (All) Names

func (All) Names() []string

type Any

type Any struct{}

Any

Syntax

["any", ...]: bool

func (Any) Exec

func (Any) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Any) Len

func (Any) Len() int

func (Any) Names

func (Any) Names() []string

type Case

type Case struct{}

Case

Syntax

["case",
  condition: boolean, output: OutputType,
  condition: boolean, output: OutputType,
  ...,
  fallback: OutputType
 ]: OutputType

func (Case) Exec

func (Case) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Case) Len

func (Case) Len() int

func (Case) Names

func (Case) Names() []string

type Coalesce

type Coalesce struct{}

Coalesce

Evaluates each expression in turn until the first non-null value is obtained, and returns that value.

Syntax

["coalesce", OutputType, OutputType, ...]: OutputType

func (Coalesce) Exec

func (Coalesce) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Coalesce) Len

func (Coalesce) Len() int

func (Coalesce) Names

func (Coalesce) Names() []string

type Div

type Div struct{}

Div

Syntax

["div", value, value]: int

func (Div) Exec

func (Div) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Div) Len

func (Div) Len() int

func (Div) Names

func (Div) Names() []string

type Eq

type Eq struct{}

Eq

Syntax

["eq", compare_value, value]: bool

func (Eq) Exec

func (Eq) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Eq) Len

func (Eq) Len() int

func (Eq) Names

func (Eq) Names() []string

type ExecFunc

type ExecFunc = func(ctx context.Context, inputs ...interface{}) (interface{}, error)

type Expr

type Expr interface {
	// Names expr name and aliases
	Names() []string
	// Len length of args
	Len() int
	// Exec final execute
	Exec(ctx context.Context, args ...interface{}) (interface{}, error)
}

type Expression

type Expression = []interface{}

type Factory

type Factory map[string]Expr

func (Factory) From

func (f Factory) From(expression Expression) (ExecFunc, error)

func (Factory) Register

func (f Factory) Register(expressions ...Expr)

type Gt

type Gt struct{}

Gt

Syntax

["gt", compare_value, value]: bool

func (Gt) Exec

func (Gt) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Gt) Len

func (Gt) Len() int

func (Gt) Names

func (Gt) Names() []string

type Gte

type Gte struct{}

Gte

Syntax

["gte", compare_value, value]: bool

func (Gte) Exec

func (Gte) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Gte) Len

func (Gte) Len() int

func (Gte) Names

func (Gte) Names() []string

type In

type In struct{}

In

Syntax

["in", "", value]: bool
["in", [...], value]: bool

func (In) Exec

func (In) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (In) Len

func (In) Len() int

func (In) Names

func (In) Names() []string

type Lt

type Lt struct{}

Lt

Syntax

["lt", compare_value, value]: bool

func (Lt) Exec

func (Lt) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Lt) Len

func (Lt) Len() int

func (Lt) Names

func (Lt) Names() []string

type Lte

type Lte struct{}

Lte

Syntax

["lte", compare_value, value]: bool

func (Lte) Exec

func (Lte) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Lte) Len

func (Lte) Len() int

func (Lte) Names

func (Lte) Names() []string

type Match

type Match struct{}

Match

Syntax

["match", "pattern", value]: bool

func (Match) Exec

func (Match) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Match) Len

func (Match) Len() int

func (Match) Names

func (Match) Names() []string

type Mod

type Mod struct{}

Mod

Syntax

["mod", value, value]: int

func (Mod) Exec

func (Mod) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Mod) Len

func (Mod) Len() int

func (Mod) Names

func (Mod) Names() []string

type Mul

type Mul struct{}

Mul

Syntax

["mul", value, value]: int

func (Mul) Exec

func (Mul) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Mul) Len

func (Mul) Len() int

func (Mul) Names

func (Mul) Names() []string

type Neq

type Neq struct{}

Neq

Syntax

["neq", compare_value, value]: bool

func (Neq) Exec

func (Neq) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Neq) Len

func (Neq) Len() int

func (Neq) Names

func (Neq) Names() []string

type Not

type Not struct{}

Not

Syntax

["not", value]: bool

func (Not) Exec

func (Not) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Not) Len

func (Not) Len() int

func (Not) Names

func (Not) Names() []string

type Pow

type Pow struct{}

Pow

Syntax

["pow", value, value]: int

func (Pow) Exec

func (Pow) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Pow) Len

func (Pow) Len() int

func (Pow) Names

func (Pow) Names() []string

type Sub

type Sub struct{}

Sub

Syntax

["sub", value, value]: int

func (Sub) Exec

func (Sub) Exec(ctx context.Context, args ...interface{}) (interface{}, error)

func (Sub) Len

func (Sub) Len() int

func (Sub) Names

func (Sub) Names() []string

type WithLitArg

type WithLitArg interface {
	LitArg() bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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