predicate

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(predicate Predicate, data schema.Schema, bind ParamBinds) bool

func EvaluateEqual

func EvaluateEqual(record schema.Schema, location string, value any) bool

func GetValue

func GetValue(x Bindable, params ParamBinds, data schema.Schema) (schema.Schema, bool)

Types

type And

type And struct {
	L []Predicate
}

type BindName

type BindName = string

type BindValue

type BindValue struct{ BindName BindName }

type Comparable

type Comparable struct {
	Location string `( @Location`
	Operator string `  @( "<>" | "<=" | ">=" | "=" | "<" | ">" | "!=" )`
	BindName Value  `  @@)`
}

func (Comparable) ToPredicate

func (a Comparable) ToPredicate() (Predicate, error)

type Compare

type Compare struct {
	Location  string
	Operation string
	BindValue Bindable
}

type Condition

type Condition struct {
	Operand *Comparable `  @@`
	Not     *Condition  `| "NOT" @@`
}

func (*Condition) ToPredicate

func (c *Condition) ToPredicate() (Predicate, error)

type Expression

type Expression struct {
	Or []*OrCondition `@@ ( "OR" @@ )*`
}

func (Expression) ToPredicate

func (e Expression) ToPredicate() (Predicate, error)

type Literal

type Literal struct{ Value schema.Schema }

type Locatable

type Locatable struct{ Location string }

type Not

type Not struct {
	P Predicate
}

type Or

type Or struct {
	L []Predicate
}

type OrCondition

type OrCondition struct {
	And []*Condition `@@ ( "AND" @@ )*`
}

func (*OrCondition) ToPredicate

func (c *OrCondition) ToPredicate() (Predicate, error)

type ParamBinds

type ParamBinds map[BindName]schema.Schema

type Value

type Value struct {
	BindName *string  `(  @Bind`
	Number   *float64 `| @Number`
	String   *string  `| @String`
	Bool     *string  `| @("TRUE" | "FALSE" | "true" | "false") `
	Location *string  `| @Location )`
}

func (Value) ToBindable

func (v Value) ToBindable() Bindable

type WherePredicates

type WherePredicates struct {
	Predicate Predicate
	Params    ParamBinds
}

func MustWhere

func MustWhere(query string, params ParamBinds) *WherePredicates

func Where

func Where(query string, params ParamBinds) (*WherePredicates, error)

func (*WherePredicates) Evaluate

func (w *WherePredicates) Evaluate(data schema.Schema) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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