filter

package
v0.0.0-...-0e4f5d7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EqualStr        = "="
	LessThanStr     = "<"
	GreaterThanStr  = ">"
	LessEqualStr    = "<="
	GreaterEqualStr = ">="
	NotEqualStr     = "!="
	LikeStr         = "like"
	NotLikeStr      = "not like"
	IsNull          = "is null"
	IsNotNull       = "is not null"
)
View Source
const (
	AscScr  = "asc"
	DescScr = "desc"
)

Order.Direction

View Source
const AND = 57347
View Source
const ASC = 57362
View Source
const DESC = 57363
View Source
const FALSE = 57360
View Source
const FLOAT = 57356
View Source
const FilterEofCode = 1
View Source
const FilterErrCode = 2
View Source
const FilterFlag = -1000
View Source
const FilterInitialStackSize = 16
View Source
const FilterLast = 64
View Source
const FilterPrivate = 57344
View Source
const GE = 57350
View Source
const INTEGRAL = 57355
View Source
const IS = 57353
View Source
const JSON_PATH = 57357
View Source
const LE = 57349
View Source
const LIKE = 57352
View Source
const MaxInt = uint64(int(MaxUint >> 1))
View Source
const MaxUint = ^uint(0)
View Source
const NE = 57351
View Source
const NOT = 57348
View Source
const NULL = 57358
View Source
const OR = 57346
View Source
const START_EXPRESSION = 57361
View Source
const START_ORDER_LIST = 57364
View Source
const STRING = 57354
View Source
const TRUE = 57359

Variables

View Source
var (
	FilterDebug        = 0
	FilterErrorVerbose = false
)
View Source
var FilterAct = [...]int{

	8, 19, 9, 7, 13, 14, 15, 16, 17, 10,
	11, 35, 6, 50, 13, 14, 15, 16, 17, 10,
	11, 37, 38, 20, 45, 47, 43, 43, 42, 44,
	2, 4, 22, 21, 3, 22, 21, 48, 23, 24,
	46, 21, 1, 36, 41, 18, 43, 12, 49, 25,
	5, 0, 0, 39, 40, 27, 29, 30, 31, 32,
	33, 34, 26, 28,
}
View Source
var FilterChk = [...]int{

	-1000, -10, 24, 28, -1, -2, 15, 6, -6, -5,
	22, 23, -4, 17, 18, 19, 20, 21, -7, -8,
	20, 5, 4, -1, -1, -3, 13, 6, 14, 7,
	8, 9, 10, 11, 12, 27, -9, 25, 26, -1,
	-1, 16, -5, -6, -5, 13, 21, 6, -8, -5,
	21,
}
View Source
var FilterDef = [...]int{

	0, -2, 0, 29, 1, 3, 0, 0, -2, 0,
	27, 28, 14, 22, 23, 24, 25, 26, 2, 30,
	33, 0, 0, 0, 7, 0, 0, 0, 0, 16,
	17, 18, 19, 20, 21, 0, 32, 34, 35, 5,
	6, 4, 9, 15, 10, 0, 12, 0, 31, 11,
	13,
}
View Source
var FilterErrorMessages = [...]struct {
	state int
	token int
	msg   string
}{}
View Source
var FilterExca = [...]int{
	-1, 1,
	1, -1,
	-2, 0,
	-1, 8,
	1, 8,
	4, 8,
	5, 8,
	16, 8,
	-2, 15,
}
View Source
var FilterPact = [...]int{

	6, -1000, -3, 3, 31, -1000, -3, -3, -1000, 49,
	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -16, -1000,
	-4, -3, -3, 28, -1000, -13, -13, 11, 19, -1000,
	-1000, -1000, -1000, -1000, -1000, 3, -1000, -1000, -1000, -1000,
	36, -1000, -1000, -1000, -1000, -13, -1000, -8, -1000, -1000,
	-1000,
}
View Source
var FilterPgo = [...]int{

	0, 31, 50, 49, 47, 2, 0, 45, 1, 43,
	42,
}
View Source
var FilterR1 = [...]int{

	0, 10, 10, 1, 1, 1, 1, 1, 1, 2,
	2, 2, 2, 2, 5, 5, 3, 3, 3, 3,
	3, 3, 4, 4, 4, 4, 4, 6, 6, 7,
	7, 7, 8, 9, 9, 9,
}
View Source
var FilterR2 = [...]int{

	0, 2, 2, 1, 3, 3, 3, 2, 1, 3,
	3, 4, 3, 4, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
	1, 3, 2, 0, 1, 1,
}
View Source
var FilterStatenames = [...]string{}
View Source
var FilterTok1 = [...]int{

	1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	15, 16, 3, 3, 27, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	8, 7, 9,
}
View Source
var FilterTok2 = [...]int{

	2, 3, 4, 5, 6, 10, 11, 12, 13, 14,
	17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
	28,
}
View Source
var FilterTok3 = [...]int{
	0,
}
View Source
var FilterToknames = [...]string{
	"$end",
	"error",
	"$unk",
	"OR",
	"AND",
	"NOT",
	"'='",
	"'<'",
	"'>'",
	"LE",
	"GE",
	"NE",
	"LIKE",
	"IS",
	"'('",
	"')'",
	"STRING",
	"INTEGRAL",
	"FLOAT",
	"JSON_PATH",
	"NULL",
	"TRUE",
	"FALSE",
	"START_EXPRESSION",
	"ASC",
	"DESC",
	"','",
	"START_ORDER_LIST",
}

Functions

func FilterErrorMessage

func FilterErrorMessage(state, lookAhead int) string

func FilterParse

func FilterParse(Filterlex FilterLexer) int

func FilterStatname

func FilterStatname(s int) string

func FilterTokname

func FilterTokname(c int) string

func Filterlex1

func Filterlex1(lex FilterLexer, lval *FilterSymType) (char, token int)

func NewNullVal

func NewNullVal() nullVal

Types

type AndExpr

type AndExpr struct {
	Left, Right Expr
}

func (AndExpr) Eval

func (e AndExpr) Eval(v interface{}) (interface{}, error)

func (AndExpr) Traverse

func (e AndExpr) Traverse(accept func(Expr) bool, visit func(Expr))

type BoolVal

type BoolVal bool

func (BoolVal) Eval

func (e BoolVal) Eval(interface{}) (interface{}, error)

func (BoolVal) Traverse

func (e BoolVal) Traverse(accept func(e Expr) bool, visit func(e Expr))

type ComparisonExpr

type ComparisonExpr struct {
	Operator    string
	Left, Right Expr
}

func (ComparisonExpr) Eval

func (e ComparisonExpr) Eval(v interface{}) (interface{}, error)

func (ComparisonExpr) Traverse

func (e ComparisonExpr) Traverse(accept func(e Expr) bool, visit func(e Expr))

type Expr

type Expr interface {
	Eval(interface{}) (interface{}, error)
	Traverse(accept func(a Expr) bool, visit func(v Expr))
}

func NewAndExpr

func NewAndExpr(left, right Expr) Expr

func NewComparisonExpr

func NewComparisonExpr(left Expr, operator string, right Expr) Expr

func NewIsNullExpr

func NewIsNullExpr(expr Expr, operator string) Expr

func NewNotExpr

func NewNotExpr(e Expr) Expr

func NewOrExpr

func NewOrExpr(left, right Expr) Expr

func ParseFilterExpression

func ParseFilterExpression(s string) (Expr, error)

type FilterLexer

type FilterLexer interface {
	Lex(lval *FilterSymType) int
	Error(s string)
}

type FilterParser

type FilterParser interface {
	Parse(FilterLexer) int
	Lookahead() int
}

func FilterNewParser

func FilterNewParser() FilterParser

type FilterParserImpl

type FilterParserImpl struct {
	// contains filtered or unexported fields
}

func (*FilterParserImpl) Lookahead

func (p *FilterParserImpl) Lookahead() int

func (*FilterParserImpl) Parse

func (Filterrcvr *FilterParserImpl) Parse(Filterlex FilterLexer) int

type FilterSymType

type FilterSymType struct {
	// contains filtered or unexported fields
}

type FloatVal

type FloatVal float64

func (FloatVal) Eval

func (e FloatVal) Eval(interface{}) (interface{}, error)

func (FloatVal) Traverse

func (e FloatVal) Traverse(accept func(e Expr) bool, visit func(e Expr))

type IntVal

type IntVal int

func (IntVal) Eval

func (e IntVal) Eval(interface{}) (interface{}, error)

func (IntVal) Traverse

func (e IntVal) Traverse(accept func(e Expr) bool, visit func(e Expr))

type IsNullExpr

type IsNullExpr struct {
	Operator string
	Expr     Expr
}

func (IsNullExpr) Eval

func (e IsNullExpr) Eval(v interface{}) (interface{}, error)

func (IsNullExpr) Traverse

func (e IsNullExpr) Traverse(accept func(e Expr) bool, visit func(e Expr))

type JSONPathVal

type JSONPathVal struct {
	JSONPath     *jsonpath.JSONPath
	JSONPathExpr string
}

func NewJSONPathVal

func NewJSONPathVal(jsonPath *jsonpath.JSONPath, pathExpr string) JSONPathVal

func (JSONPathVal) Eval

func (e JSONPathVal) Eval(v interface{}) (interface{}, error)

func (JSONPathVal) Traverse

func (e JSONPathVal) Traverse(accept func(e Expr) bool, visit func(e Expr))

type NotExpr

type NotExpr struct {
	Expr Expr
}

func (NotExpr) Eval

func (e NotExpr) Eval(v interface{}) (interface{}, error)

func (NotExpr) Traverse

func (e NotExpr) Traverse(accept func(e Expr) bool, visit func(e Expr))

type OrExpr

type OrExpr struct {
	Left, Right Expr
}

func (OrExpr) Eval

func (e OrExpr) Eval(v interface{}) (interface{}, error)

func (OrExpr) Traverse

func (e OrExpr) Traverse(accept func(e Expr) bool, visit func(e Expr))

type Order

type Order struct {
	Expr      Expr
	Direction string
}

func NewOrder

func NewOrder(expr Expr, dir string) *Order

type OrderBy

type OrderBy []*Order

func NewEmptyOrderBy

func NewEmptyOrderBy() OrderBy

func NewOrderBy

func NewOrderBy(order *Order) OrderBy

func ParseOrderByExpression

func ParseOrderByExpression(s string) (OrderBy, error)

func (OrderBy) Sort

func (o OrderBy) Sort(slice interface{}) error

type StringVal

type StringVal string

func (StringVal) Eval

func (e StringVal) Eval(interface{}) (interface{}, error)

func (StringVal) Traverse

func (e StringVal) Traverse(accept func(e Expr) bool, visit func(e Expr))

Jump to

Keyboard shortcuts

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