Skip to main content

MetadataFilterBuilder

Struct MetadataFilterBuilder 

Source
pub struct MetadataFilterBuilder { /* private fields */ }
Expand description

Builder for MetadataFilter.

Predicates without an explicit connector (eq, gt, exists, and so on) are appended with logical AND. Use or_* methods or group methods for more complex expressions.

Implementations§

Source§

impl MetadataFilterBuilder

Source

pub fn build(self) -> MetadataResult<MetadataFilter>

Builds an immutable MetadataFilter.

§Errors

Returns MetadataError::InvalidFilterExpression when the builder contains a structurally invalid expression such as an empty grouped expression.

Source

pub fn build_checked( self, schema: &MetadataSchema, ) -> MetadataResult<MetadataFilter>

Builds an immutable filter and validates it against schema.

§Errors

Returns an error when the filter expression is structurally invalid, the filter references unknown schema fields, uses range operators on non-comparable field types, or compares a field with an incompatible value type.

Source

pub fn with_options(self, options: FilterMatchOptions) -> Self

Replaces the match options used by the built filter.

Source

pub fn missing_key_policy(self, missing_key_policy: MissingKeyPolicy) -> Self

Sets how the built filter treats missing keys in negative predicates.

Source

pub fn number_comparison_policy( self, number_comparison_policy: NumberComparisonPolicy, ) -> Self

Sets how the built filter handles mixed numeric comparisons.

Source

pub fn eq<T>(self, key: &str, value: T) -> Self

Appends an equality predicate with AND: key == value.

Source

pub fn ne<T>(self, key: &str, value: T) -> Self

Appends a not-equal predicate with AND: key != value.

Source

pub fn lt<T>(self, key: &str, value: T) -> Self

Appends a less-than predicate with AND: key < value.

Source

pub fn le<T>(self, key: &str, value: T) -> Self

Appends a less-than-or-equal predicate with AND: key <= value.

Source

pub fn gt<T>(self, key: &str, value: T) -> Self

Appends a greater-than predicate with AND: key > value.

Source

pub fn ge<T>(self, key: &str, value: T) -> Self

Appends a greater-than-or-equal predicate with AND: key >= value.

Source

pub fn in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an inclusion predicate with AND: key is in values.

Source

pub fn not_in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an exclusion predicate with AND: key is not in values.

Source

pub fn exists(self, key: &str) -> Self

Appends an existence predicate with AND.

Source

pub fn not_exists(self, key: &str) -> Self

Appends a non-existence predicate with AND.

Source

pub fn and_eq<T>(self, key: &str, value: T) -> Self

Appends an equality predicate with AND: key == value.

Source

pub fn and_ne<T>(self, key: &str, value: T) -> Self

Appends a not-equal predicate with AND: key != value.

Source

pub fn and_lt<T>(self, key: &str, value: T) -> Self

Appends a less-than predicate with AND: key < value.

Source

pub fn and_le<T>(self, key: &str, value: T) -> Self

Appends a less-than-or-equal predicate with AND: key <= value.

Source

pub fn and_gt<T>(self, key: &str, value: T) -> Self

Appends a greater-than predicate with AND: key > value.

Source

pub fn and_ge<T>(self, key: &str, value: T) -> Self

Appends a greater-than-or-equal predicate with AND: key >= value.

Source

pub fn and_in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an inclusion predicate with AND: key is in values.

Source

pub fn and_not_in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an exclusion predicate with AND: key is not in values.

Source

pub fn and_exists(self, key: &str) -> Self

Appends an existence predicate with AND.

Source

pub fn and_not_exists(self, key: &str) -> Self

Appends a non-existence predicate with AND.

Source

pub fn or_eq<T>(self, key: &str, value: T) -> Self

Appends an equality predicate with OR: key == value.

Source

pub fn or_ne<T>(self, key: &str, value: T) -> Self

Appends a not-equal predicate with OR: key != value.

Source

pub fn or_lt<T>(self, key: &str, value: T) -> Self

Appends a less-than predicate with OR: key < value.

Source

pub fn or_le<T>(self, key: &str, value: T) -> Self

Appends a less-than-or-equal predicate with OR: key <= value.

Source

pub fn or_gt<T>(self, key: &str, value: T) -> Self

Appends a greater-than predicate with OR: key > value.

Source

pub fn or_ge<T>(self, key: &str, value: T) -> Self

Appends a greater-than-or-equal predicate with OR: key >= value.

Source

pub fn or_in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an inclusion predicate with OR: key is in values.

Source

pub fn or_not_in_set<I, T>(self, key: &str, values: I) -> Self
where I: IntoIterator<Item = T>, T: IntoMetadataValue,

Appends an exclusion predicate with OR: key is not in values.

Source

pub fn or_exists(self, key: &str) -> Self

Appends an existence predicate with OR.

Source

pub fn or_not_exists(self, key: &str) -> Self

Appends a non-existence predicate with OR.

Source

pub fn and<F>(self, build: F) -> Self
where F: FnOnce(Self) -> Self,

Appends a grouped expression with AND.

The closure receives a fresh builder for the group. Policies configured inside the group are ignored; configure policies on the outer builder.

Source

pub fn or<F>(self, build: F) -> Self
where F: FnOnce(Self) -> Self,

Appends a grouped expression with OR.

The closure receives a fresh builder for the group. Policies configured inside the group are ignored; configure policies on the outer builder.

Source

pub fn and_not<F>(self, build: F) -> Self
where F: FnOnce(Self) -> Self,

Appends a negated grouped expression with AND.

Source

pub fn or_not<F>(self, build: F) -> Self
where F: FnOnce(Self) -> Self,

Appends a negated grouped expression with OR.

Source

pub fn not(self) -> Self

Negates the entire builder expression.

Trait Implementations§

Source§

impl Clone for MetadataFilterBuilder

Source§

fn clone(&self) -> MetadataFilterBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetadataFilterBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MetadataFilterBuilder

Source§

fn default() -> MetadataFilterBuilder

Returns the “default value” for a type. Read more
Source§

impl PartialEq for MetadataFilterBuilder

Source§

fn eq(&self, other: &MetadataFilterBuilder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MetadataFilterBuilder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.