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
impl MetadataFilterBuilder
Sourcepub fn build(self) -> MetadataResult<MetadataFilter>
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.
Sourcepub fn build_checked(
self,
schema: &MetadataSchema,
) -> MetadataResult<MetadataFilter>
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.
Sourcepub fn with_options(self, options: FilterMatchOptions) -> Self
pub fn with_options(self, options: FilterMatchOptions) -> Self
Replaces the match options used by the built filter.
Sourcepub fn missing_key_policy(self, missing_key_policy: MissingKeyPolicy) -> Self
pub fn missing_key_policy(self, missing_key_policy: MissingKeyPolicy) -> Self
Sets how the built filter treats missing keys in negative predicates.
Sourcepub fn number_comparison_policy(
self,
number_comparison_policy: NumberComparisonPolicy,
) -> Self
pub fn number_comparison_policy( self, number_comparison_policy: NumberComparisonPolicy, ) -> Self
Sets how the built filter handles mixed numeric comparisons.
Sourcepub fn eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends an equality predicate with AND: key == value.
Sourcepub fn ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a not-equal predicate with AND: key != value.
Sourcepub fn lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than predicate with AND: key < value.
Sourcepub fn le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than-or-equal predicate with AND: key <= value.
Sourcepub fn gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than predicate with AND: key > value.
Sourcepub fn ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than-or-equal predicate with AND: key >= value.
Sourcepub fn in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an inclusion predicate with AND: key is in values.
Sourcepub fn not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an exclusion predicate with AND: key is not in values.
Sourcepub fn not_exists(self, key: &str) -> Self
pub fn not_exists(self, key: &str) -> Self
Appends a non-existence predicate with AND.
Sourcepub fn and_eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends an equality predicate with AND: key == value.
Sourcepub fn and_ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a not-equal predicate with AND: key != value.
Sourcepub fn and_lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than predicate with AND: key < value.
Sourcepub fn and_le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than-or-equal predicate with AND: key <= value.
Sourcepub fn and_gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than predicate with AND: key > value.
Sourcepub fn and_ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn and_ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than-or-equal predicate with AND: key >= value.
Sourcepub fn and_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn and_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an inclusion predicate with AND: key is in values.
Sourcepub fn and_not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn and_not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an exclusion predicate with AND: key is not in values.
Sourcepub fn and_exists(self, key: &str) -> Self
pub fn and_exists(self, key: &str) -> Self
Appends an existence predicate with AND.
Sourcepub fn and_not_exists(self, key: &str) -> Self
pub fn and_not_exists(self, key: &str) -> Self
Appends a non-existence predicate with AND.
Sourcepub fn or_eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_eq<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends an equality predicate with OR: key == value.
Sourcepub fn or_ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_ne<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a not-equal predicate with OR: key != value.
Sourcepub fn or_lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_lt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than predicate with OR: key < value.
Sourcepub fn or_le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_le<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a less-than-or-equal predicate with OR: key <= value.
Sourcepub fn or_gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_gt<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than predicate with OR: key > value.
Sourcepub fn or_ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
pub fn or_ge<T>(self, key: &str, value: T) -> Selfwhere
T: IntoMetadataValue,
Appends a greater-than-or-equal predicate with OR: key >= value.
Sourcepub fn or_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn or_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an inclusion predicate with OR: key is in values.
Sourcepub fn or_not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
pub fn or_not_in_set<I, T>(self, key: &str, values: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: IntoMetadataValue,
Appends an exclusion predicate with OR: key is not in values.
Sourcepub fn or_not_exists(self, key: &str) -> Self
pub fn or_not_exists(self, key: &str) -> Self
Appends a non-existence predicate with OR.
Sourcepub fn and<F>(self, build: F) -> Selfwhere
F: FnOnce(Self) -> Self,
pub fn and<F>(self, build: F) -> Selfwhere
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.
Sourcepub fn or<F>(self, build: F) -> Selfwhere
F: FnOnce(Self) -> Self,
pub fn or<F>(self, build: F) -> Selfwhere
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.
Sourcepub fn and_not<F>(self, build: F) -> Selfwhere
F: FnOnce(Self) -> Self,
pub fn and_not<F>(self, build: F) -> Selfwhere
F: FnOnce(Self) -> Self,
Appends a negated grouped expression with AND.
Trait Implementations§
Source§impl Clone for MetadataFilterBuilder
impl Clone for MetadataFilterBuilder
Source§fn clone(&self) -> MetadataFilterBuilder
fn clone(&self) -> MetadataFilterBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetadataFilterBuilder
impl Debug for MetadataFilterBuilder
Source§impl Default for MetadataFilterBuilder
impl Default for MetadataFilterBuilder
Source§fn default() -> MetadataFilterBuilder
fn default() -> MetadataFilterBuilder
Source§impl PartialEq for MetadataFilterBuilder
impl PartialEq for MetadataFilterBuilder
Source§fn eq(&self, other: &MetadataFilterBuilder) -> bool
fn eq(&self, other: &MetadataFilterBuilder) -> bool
self and other values to be equal, and is used by ==.