filter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And []ValueFilter

func (And) FilterValue

func (arr And) FilterValue(v values.Value) bool

type Any

type Any struct{}

func (Any) FilterSortable

func (Any) FilterSortable(v values.Sortable) bool

func (Any) FilterValue

func (Any) FilterValue(v values.Value) bool

func (Any) ValuesRange

func (Any) ValuesRange() *Range

type Equal

type Equal struct {
	Value values.Value
}

func (Equal) FilterSortable

func (f Equal) FilterSortable(a values.Sortable) bool

func (Equal) FilterValue

func (f Equal) FilterValue(a values.Value) bool

func (Equal) ValuesRange

func (f Equal) ValuesRange() *Range

type Greater

type Greater struct {
	Value values.Sortable
	Equal bool
}

func GT

func GT(v values.Sortable) *Greater

GT is a "greater than" filter. Shorthand for Greater.

func GTE

func GTE(v values.Sortable) *Greater

GTE is a "greater than or equal" filter. Shorthand for Greater.

func (Greater) FilterSortable

func (f Greater) FilterSortable(v values.Sortable) bool

func (Greater) FilterValue

func (f Greater) FilterValue(v values.Value) bool

func (Greater) ValuesRange

func (f Greater) ValuesRange() *Range

type Less

type Less struct {
	Value values.Sortable
	Equal bool
}

func LT

func LT(v values.Sortable) *Less

LT is a "less than" filter. Shorthand for Less.

func LTE

func LTE(v values.Sortable) *Less

LTE is a "less than or equal" filter. Shorthand for Less.

func (Less) FilterSortable

func (f Less) FilterSortable(v values.Sortable) bool

func (Less) FilterValue

func (f Less) FilterValue(v values.Value) bool

func (Less) ValuesRange

func (f Less) ValuesRange() *Range

type Not

type Not struct {
	Filter ValueFilter
}

func (Not) FilterValue

func (f Not) FilterValue(v values.Value) bool

type Or

type Or []ValueFilter

func (Or) FilterValue

func (arr Or) FilterValue(v values.Value) bool

type Range

type Range struct {
	Start *Greater
	End   *Less
}

Range represents a range of sortable values. If inclusive is set, the range is [start, end], if not, the range is (start, end).

func (Range) FilterSortable

func (f Range) FilterSortable(v values.Sortable) bool

func (Range) FilterValue

func (f Range) FilterValue(v values.Value) bool

func (Range) Prefix

func (f Range) Prefix() (values.BinaryString, bool)

Prefix returns a common prefix of the range. Boolean flag indicates if prefix fully describes the range.

func (Range) ValuesRange

func (f Range) ValuesRange() *Range

type SortableFilter

type SortableFilter interface {
	ValueFilter
	FilterSortable(v values.Sortable) bool
	// ValuesRange returns an optional range of value that matches the filter.
	// It is used as an optimization for complex filters for backend to limit the range of keys that will be considered.
	ValuesRange() *Range
}

func EQ

EQ is a shorthand for Equal.

func Prefix

func Prefix(pref values.BinaryString) SortableFilter

type ValueFilter

type ValueFilter interface {
	FilterValue(v values.Value) bool
}

Jump to

Keyboard shortcuts

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