v0.7.0

filter Package

Last updated

This page lists the exported API of core/store/filter, which builds and evaluates QUERY and FIND conditions.

Types and Functions

type Filter interface {
    Match(obj any) bool
}

type Operator int
const (
    EqualTo Operator = iota
    GreaterThan
    GreaterThanOrEqualTo
    LessThan
    LessThanOrEqualTo
    NotEqualTo
    Like
)

type Cond struct {
    Field string
    Op    Operator
    Value string
}

type And []Filter
type Or []Filter
type Not [1]Filter

func AtoFilter(str string) (Filter, error)
func AtoOperation(s string) (Operator, bool)
func Match(stored string, op Operator, target string) bool

Shorthand conditions EQ, NE, GT, GTE, GE, LT, LTE, LE, and LIKE each have Field and Value string fields. Parser (Or, And, Not, Primary, Current) is exported and used by AtoFilter.

中文