uni_filter

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const FieldOpSep = "__"
View Source
const FieldParamSep = "="
View Source
const FieldSep = "."
View Source
const OPParamsSep = "__"

Variables

This section is empty.

Functions

func All

func All(flags []bool) bool

func Any

func Any(flags []bool) bool

func Contains

func Contains(arr []string, t string) bool

Types

type EndGroupExpr

type EndGroupExpr struct {
	Expr
}

func (*EndGroupExpr) Match

func (e *EndGroupExpr) Match(data any) bool

type Expr

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

func (*Expr) Strings

func (e *Expr) Strings() string

type Filter

type Filter struct {
	// 原始未解析的 key
	Key string
	// 原始未解析的 value
	Value string
	// contains filtered or unexported fields
}

func ParseFilterString

func ParseFilterString(s string) (*Filter, error)

func (*Filter) String

func (f *Filter) String() string

type IExpr

type IExpr interface {
	Match(v any) bool
	Strings() string
}

func Parse

func Parse(expr string) (IExpr, error)

type Key

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

type Logic

type Logic uint8
var AND Logic = 0
var OR Logic = 1

func (Logic) Strings

func (l Logic) Strings() string

type LogicExpr

type LogicExpr struct {
	Expr
	// contains filtered or unexported fields
}

func (*LogicExpr) Match

func (e *LogicExpr) Match(data any) bool

func (*LogicExpr) Strings

func (le *LogicExpr) Strings() string

type OP

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

func NewOPEmpty

func NewOPEmpty(s string) (OP, error)

func NewOPEnds

func NewOPEnds(s string) (OP, error)

func NewOPEqual

func NewOPEqual(s string) (OP, error)

func NewOPExists

func NewOPExists(s string) (OP, error)

func NewOPGT

func NewOPGT(s string) (OP, error)

func NewOPGTE

func NewOPGTE(s string) (OP, error)

func NewOPIEnds

func NewOPIEnds(s string) (OP, error)

func NewOPILike

func NewOPILike(s string) (OP, error)

func NewOPIStarts

func NewOPIStarts(s string) (OP, error)

func NewOPLT

func NewOPLT(s string) (OP, error)

func NewOPLTE

func NewOPLTE(s string) (OP, error)

func NewOPLike

func NewOPLike(s string) (OP, error)

func NewOPStarts

func NewOPStarts(s string) (OP, error)

func NewOPTimeRangeA

func NewOPTimeRangeA(s string) (OP, error)

func NewOPTimeRangeAMS

func NewOPTimeRangeAMS(s string) (OP, error)

func NewOPTimeRangeR

func NewOPTimeRangeR(s string) (OP, error)

func NewOPTimeRangeRMS

func NewOPTimeRangeRMS(s string) (OP, error)

type OPEmpty

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

func (*OPEmpty) Name

func (op *OPEmpty) Name() string

type OPEnds

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

func (*OPEnds) Name

func (op *OPEnds) Name() string

type OPEqual

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

func (*OPEqual) Name

func (op *OPEqual) Name() string

type OPExists

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

func (*OPExists) Name

func (op *OPExists) Name() string

type OPFunc

type OPFunc func(*Filter, interface{}) bool

type OPGT

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

func (*OPGT) Name

func (op *OPGT) Name() string

type OPLT

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

func (*OPLT) Name

func (op *OPLT) Name() string

type OPLike

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

func (*OPLike) Name

func (op *OPLike) Name() string

type OPNewFunc

type OPNewFunc func(string) (OP, error)

type OPStarts

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

func (*OPStarts) Name

func (op *OPStarts) Name() string

type OPTimeRange

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

func (*OPTimeRange) Name

func (op *OPTimeRange) Name() string

type SimpleExpr

type SimpleExpr struct {
	Expr
	// contains filtered or unexported fields
}

func (*SimpleExpr) Match

func (se *SimpleExpr) Match(data any) bool

func (*SimpleExpr) Strings

func (se *SimpleExpr) Strings() string

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any]() *Stack[T]

NewStack creates a new stack object.

func (*Stack[T]) Clear

func (s *Stack[T]) Clear()

Clear removes all data from the stack

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

IsEmpty returns true if the stack is empty.

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (v T)

Pop removes a value from the stack.

func (*Stack[T]) Push

func (s *Stack[T]) Push(v T)

Push appends the specified value to the stack.

func (*Stack[T]) Size

func (s *Stack[T]) Size() int

Size retrieves the number of entries stored upon the stack.

func (*Stack[T]) Top

func (s *Stack[T]) Top() (v T)

Top return the latest value from the stack, but not remove it

type StartGroupExpr

type StartGroupExpr struct {
	Expr
	// contains filtered or unexported fields
}

func (*StartGroupExpr) Match

func (e *StartGroupExpr) Match(data any) bool

func (*StartGroupExpr) Strings

func (sge *StartGroupExpr) Strings() string

type Token

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

func (Token) String

func (t Token) String() string

type TokenError

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

func (TokenError) Error

func (te TokenError) Error() string

type Tokenizer

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

func (*Tokenizer) Parse

func (t *Tokenizer) Parse() chan Token

type Value

type Value struct {
	S string // clean string
	V any
}

Jump to

Keyboard shortcuts

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