Documentation
¶
Index ¶
- type BoolFilter
- type BytesFilter
- type Combinator
- type DoubleFilter
- type IntFilter
- type Op
- func (f Op) AllowedTypes(v *field.ValueUnion) (field.ValueTypeSet, error)
- func (f Op) BoolFilter(v *field.ValueUnion) (BoolFilter, error)
- func (f Op) BoolIsInRange(numTrues, numFalses int, filterVal bool) bool
- func (f Op) BytesFilter(v *field.ValueUnion) (BytesFilter, error)
- func (f Op) BytesMaybeInRange(min, max, filterVal []byte) bool
- func (f Op) DocIDSetFilterFn(numTotalDocs int32) (index.DocIDSetIteratorFn, error)
- func (f Op) DoubleFilter(v *field.ValueUnion) (DoubleFilter, error)
- func (f Op) DoubleMaybeInIntRange(min, max int, filterVal float64) (int, bool, error)
- func (f Op) DoubleMaybeInRange(min, max, filterVal float64) bool
- func (f Op) IntFilter(v *field.ValueUnion) (IntFilter, error)
- func (f Op) IntMaybeInRange(min, max, filterVal int) bool
- func (f Op) IsDocIDSetFilter() bool
- func (f Op) IsValid() bool
- func (f Op) IsValueFilter() bool
- func (f Op) MultiTypeCombinator() (Combinator, error)
- func (f Op) MustDocIDSetFilterFn(numTotalDocs int32) index.DocIDSetIteratorFn
- func (f Op) String() string
- func (f Op) TimeFilter(v *field.ValueUnion) (TimeFilter, error)
- func (f Op) TimeMaybeInRange(min, max, filterVal int64) bool
- func (f Op) ToProto() (servicepb.Filter_Op, error)
- func (f *Op) UnmarshalJSON(data []byte) error
- type TimeFilter
- type TimeRangeFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolFilter ¶
type BoolFilter interface { // Match returns true if the given value is considered a match. Match(v bool) bool }
BoolFilter matches against bool values.
type BytesFilter ¶
type BytesFilter interface { // Match returns true if the given value is considered a match. Match(v xbytes.Bytes) bool }
BytesFilter matches against bytes values.
type Combinator ¶
type Combinator int
Combinator combines multiple filters.
const ( UnknownCombinator Combinator = iota And Or )
A list of supported filter combinators.
func (Combinator) String ¶
func (f Combinator) String() string
String returns the string representation of the filter combinator.
func (*Combinator) ToProto ¶
func (f *Combinator) ToProto() (servicepb.OptionalFilterCombinator, error)
ToProto converts a filter combinator to an optional filter combinator protobuf message.
func (*Combinator) UnmarshalJSON ¶
func (f *Combinator) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a JSON object as a filter combinator.
type DoubleFilter ¶
type DoubleFilter interface { // Match returns true if the given value is considered a match. Match(v float64) bool }
DoubleFilter matches against double values.
type IntFilter ¶
type IntFilter interface { // Match returns true if the given value is considered a match. Match(v int) bool }
IntFilter matches against int values.
type Op ¶
type Op int
Op represents a filter operator.
const ( UnknownOp Op = iota Equals NotEquals LargerThan LargerThanOrEqual SmallerThan SmallerThanOrEqual StartsWith DoesNotStartWith EndsWith DoesNotEndWith Contains DoesNotContain IsNull IsNotNull Exists DoesNotExist )
A list of supported filter operators.
func (Op) AllowedTypes ¶
func (f Op) AllowedTypes(v *field.ValueUnion) (field.ValueTypeSet, error)
AllowedTypes returns a list of value types that are allowed for the given filter operator and the right-hand-side value.
func (Op) BoolFilter ¶
func (f Op) BoolFilter(v *field.ValueUnion) (BoolFilter, error)
BoolFilter returns a bool filter using the given value as the filter arguments.
func (Op) BoolIsInRange ¶
BoolIsInRange returns true if filterVal exists in the values that this filter is acting on.
func (Op) BytesFilter ¶
func (f Op) BytesFilter(v *field.ValueUnion) (BytesFilter, error)
BytesFilter returns a bytes filter using the given value as the filter arguments.
func (Op) BytesMaybeInRange ¶
BytesMaybeInRange returns true if filterVal is within the range defined in by min and max. If this returns false, it means filterVal is definitely not within the value range [min, max]. If this returns true, it doesn't necessarily mean the filterVal exists in the values that this filter is acting on.
func (Op) DocIDSetFilterFn ¶
func (f Op) DocIDSetFilterFn(numTotalDocs int32) (index.DocIDSetIteratorFn, error)
DocIDSetFilterFn returns the function associated with the filter operator to transform an input doc ID set iterator into a new doc ID set iterator, if applicable. This is used to distinguish doc ID filter operators such as `Exist` and `DoesNotExist` whose application transforms the doc ID set of a field into a new doc ID set. This is in contrast with other value filters that operate on the field values. If the operator is a valid value filter operator, it returns a nil function with a nil error. If the operator is invalid, it returns an error.
func (Op) DoubleFilter ¶
func (f Op) DoubleFilter(v *field.ValueUnion) (DoubleFilter, error)
DoubleFilter returns a double filter using the given value as the filter arguments.
func (Op) DoubleMaybeInIntRange ¶
DoubleMaybeInIntRange returns true if filterVal may produce a match against the int values in the int range [min, max]. If this returns false, it means there can be no value match within the int value range [min, max] against the given double filter value. If this returns true, it returns the equivalent integer value for more efficient filtering, but doesn't guarantee a match against the integer values in range [min, max].
func (Op) DoubleMaybeInRange ¶
DoubleMaybeInRange returns true if filterVal is within the range defined by min and max. If this returns false, it means filterVal is definitely not within the value range [min, max]. If this returns true, it doesn't necessarily mean the filterVal exists in the values that this filter is acting on.
func (Op) IntFilter ¶
func (f Op) IntFilter(v *field.ValueUnion) (IntFilter, error)
IntFilter returns an int filter using the given value as the filter arguments.
func (Op) IntMaybeInRange ¶
IntMaybeInRange returns true if filterVal is within the range defined by min and max. If this returns false, it means filterVal is definitely not within the value range [min, max]. If this returns true, it doesn't necessarily mean the filterVal exists in the values that this filter is acting on.
func (Op) IsDocIDSetFilter ¶
IsDocIDSetFilter returns true if the filter should be applied to the doc ID set associated with the field values.
func (Op) IsValueFilter ¶
IsValueFilter returns true if the filter should be applied to individual field values.
func (Op) MultiTypeCombinator ¶
func (f Op) MultiTypeCombinator() (Combinator, error)
MultiTypeCombinator returns the filter combinator to join the filter result for multi-typed field values. Specifically, if a field has values of type A and values of type B, applying the operator against the field will produce a result as follows: `filter(field) = filter(field_type_A) Combinator filter(field_type_B)`, where the Combinator is returned by this function.
func (Op) MustDocIDSetFilterFn ¶
func (f Op) MustDocIDSetFilterFn(numTotalDocs int32) index.DocIDSetIteratorFn
MustDocIDSetFilterFn returns the function associated with the filter operator to transform an input doc ID set iterator into a new doc ID set iterator, or panics if an error is encountered.
func (Op) TimeFilter ¶
func (f Op) TimeFilter(v *field.ValueUnion) (TimeFilter, error)
TimeFilter returns a time filter using the given value as the filter arguments.
func (Op) TimeMaybeInRange ¶
TimeMaybeInRange returns true if filterVal is within the range defined by min and max. If this returns false, it means filterVal is definitely not within the value range [min, max]. If this returns true, it doesn't necessarily mean the filterVal exists in the values that this filter is acting on.
func (*Op) UnmarshalJSON ¶
UnmarshalJSON unmarshals a JSON object as a filter operator.
type TimeFilter ¶
type TimeFilter interface { // Match returns true if the given value is considered a match. Match(v int64) bool }
TimeFilter matches against time values.
type TimeRangeFilter ¶
type TimeRangeFilter struct {
// contains filtered or unexported fields
}
TimeRangeFilter is a time range filter that matches time values in [startNanosInclusive, endNanosExclusive).
func NewTimeRangeFilter ¶
func NewTimeRangeFilter( startNanosInclusive int64, endNanosExclusive int64, ) *TimeRangeFilter
NewTimeRangeFilter creates a new time range filter.
func (*TimeRangeFilter) Match ¶
func (f *TimeRangeFilter) Match(timeNanos int64) bool
Match returns true if the time value in nanoseconds is in [start, end).