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


  1. type Filter interface {
  2. Match(obj any) bool
  3. }
  4. type Operator int
  5. const (
  6. EqualTo Operator = iota
  7. GreaterThan
  8. GreaterThanOrEqualTo
  9. LessThan
  10. LessThanOrEqualTo
  11. NotEqualTo
  12. Like
  13. )
  14. type Cond struct {
  15. Field string
  16. Op Operator
  17. Value string
  18. }
  19. type And []Filter
  20. type Or []Filter
  21. type Not [1]Filter
  22. func AtoFilter(str string) (Filter, error)
  23. func AtoOperation(s string) (Operator, bool)
  24. 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.

中文