predicate

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LiteralTypeString = iota
	LiteralTypeBoolean
	LiteralTypeDecimal
	LiteralTypeNull
)
View Source
const (
	Unknown = -1
	EOF     = 0
)
View Source
const AND = 57361
View Source
const BOOLEAN = 57365
View Source
const COMMA = 57346
View Source
const DOT = 57347
View Source
const END = 57352
View Source
const EQUAL = 57355
View Source
const GREATER = 57353
View Source
const IDENT = 57363
View Source
const IN = 57359
View Source
const INTEGER = 57366
View Source
const LBRACK = 57350
View Source
const LESS = 57354
View Source
const LIKE = 57357
View Source
const LPAREN = 57348
View Source
const MATCH = 57358
View Source
const MINUS = 57360
View Source
const NOT = 57356
View Source
const NULL = 57367
View Source
const OR = 57362
View Source
const RBRACK = 57351
View Source
const RPAREN = 57349
View Source
const STRING = 57364

Variables

View Source
var (
	String  = &LiteralType{Type: LiteralTypeString}
	Boolean = &LiteralType{Type: LiteralTypeBoolean}
	Decimal = &LiteralType{Type: LiteralTypeDecimal}
)
View Source
var (
	Greater = &OperatorType{Type: GREATER}
	Less    = &OperatorType{Type: LESS}
	Equal   = &OperatorType{Type: EQUAL}
	Not     = &OperatorType{Type: NOT}
	Like    = &OperatorType{Type: LIKE}
	Match   = &OperatorType{Type: MATCH}
	In      = &OperatorType{Type: IN}
	Minus   = &OperatorType{Type: MINUS}
	And     = &OperatorType{Type: AND}
	Or      = &OperatorType{Type: OR}
)
View Source
var Null = &LiteralExpr{
	Type:  &LiteralType{Type: LiteralTypeNull},
	Value: "null",
}

Functions

func Parse

func Parse(predicate string) (string, error)

Types

type BinaryExpr added in v0.11.0

type BinaryExpr struct {
	Op    []*OperatorType
	Left  Expr
	Right Expr
}

type ComboExpr added in v0.11.0

type ComboExpr struct {
	Items []ComboItem
}

type ComboItem added in v0.11.0

type ComboItem any

ComboItem will only contain two types, Expr and []*OperatorType, currently, the value of Expr should only be *BinaryExpr

type Expr added in v0.11.0

type Expr interface {
	// contains filtered or unexported methods
}

type Field added in v0.11.0

type Field any

Field will only contain two types, *Ident and *LiteralType, where the value of *LiteralType must be an integer

type FieldsExpr added in v0.11.0

type FieldsExpr struct {
	Fields []Field
}

type Ident added in v0.11.0

type Ident struct {
	Name string
}

type LiteralExpr added in v0.11.0

type LiteralExpr struct {
	Type  *LiteralType
	Value string
}

type LiteralListExpr added in v0.11.0

type LiteralListExpr struct {
	List []*LiteralExpr
}

type LiteralType added in v0.11.0

type LiteralType struct {
	Type int
}

type OperatorType added in v0.11.0

type OperatorType struct {
	Type int
}

type ParenExpr added in v0.11.0

type ParenExpr struct {
	Expr Expr
}

type Tree added in v0.11.0

type Tree struct {
	Expr Expr
}

func ParseAST added in v0.11.0

func ParseAST(predicate string) (*Tree, error)

func (*Tree) String added in v0.11.0

func (t *Tree) String() string

func (*Tree) Transform added in v0.11.0

func (t *Tree) Transform()

Jump to

Keyboard shortcuts

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