filter 套件
最後更新
本頁列出
core/store/filter 的公開 API,用於建立與評估 QUERY、FIND 條件。型別與函式
- 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
簡寫條件
EQ、NE、GT、GTE、GE、LT、LTE、LE、LIKE 各有 Field 與 Value 字串欄位。Parser(Or、And、Not、Primary、Current)為公開型別,由 AtoFilter 使用。