pub struct FilterBuilder<'a, 'b> { /* private fields */ }Expand description
Builder for constructing document filter expressions.
This struct provides methods for comparing document fields with values to create filter conditions.
§Examples
// Combine multiple filter conditions
db.query("products")
.filter(|f| {
f.gte("price", 10.0) &&
f.lte("price", 50.0) &&
f.contains("name", "widget")
})
.collect()
.await?;Implementations§
Source§impl<'a, 'b> FilterBuilder<'a, 'b>
impl<'a, 'b> FilterBuilder<'a, 'b>
Sourcepub fn in_values<T: Into<Value> + Clone>(
&self,
field: &str,
values: &[T],
) -> bool
pub fn in_values<T: Into<Value> + Clone>( &self, field: &str, values: &[T], ) -> bool
Check if a field is in a list of values
§Examples
.filter(|f| f.in_values("status", &["active", "inactive"]))Sourcepub fn starts_with(&self, field: &str, prefix: &str) -> bool
pub fn starts_with(&self, field: &str, prefix: &str) -> bool
Sourcepub fn array_len_eq(&self, field: &str, len: usize) -> bool
pub fn array_len_eq(&self, field: &str, len: usize) -> bool
Sourcepub fn get_nested_value(&self, path: &str) -> Option<&Value>
pub fn get_nested_value(&self, path: &str) -> Option<&Value>
Access a nested field using dot notation
§Examples
.filter(|f| f.get_nested_value("user.address.city") == Some(&Value::String("New York")))Auto Trait Implementations§
impl<'a, 'b> Freeze for FilterBuilder<'a, 'b>
impl<'a, 'b> RefUnwindSafe for FilterBuilder<'a, 'b>
impl<'a, 'b> Send for FilterBuilder<'a, 'b>
impl<'a, 'b> Sync for FilterBuilder<'a, 'b>
impl<'a, 'b> Unpin for FilterBuilder<'a, 'b>
impl<'a, 'b> UnwindSafe for FilterBuilder<'a, 'b>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more