pub struct FluentFilterBuilder { /* private fields */ }Expand description
A fluent builder for constructing filters with a convenient API.
This builder collects conditions and can produce either an AND or OR filter.
§Examples
use prax_query::filter::Filter;
// Build an AND filter
let filter = Filter::builder()
.eq("active", true)
.gt("score", 100)
.contains("email", "@example.com")
.build_and();
// Build an OR filter with capacity hint
let filter = Filter::builder()
.with_capacity(3)
.eq("role", "admin")
.eq("role", "moderator")
.eq("role", "owner")
.build_or();Implementations§
Source§impl FluentFilterBuilder
impl FluentFilterBuilder
Sourcepub fn with_capacity(self, capacity: usize) -> Self
pub fn with_capacity(self, capacity: usize) -> Self
Set the capacity hint for the internal vector.
Sourcepub fn starts_with<F, V>(self, field: F, value: V) -> Self
pub fn starts_with<F, V>(self, field: F, value: V) -> Self
Add a starts with filter (LIKE value%).
Sourcepub fn ends_with<F, V>(self, field: F, value: V) -> Self
pub fn ends_with<F, V>(self, field: F, value: V) -> Self
Add an ends with filter (LIKE %value).
Sourcepub fn is_not_null<F>(self, field: F) -> Self
pub fn is_not_null<F>(self, field: F) -> Self
Add an IS NOT NULL filter.
Sourcepub fn filter_if_some<F>(self, opt: Option<F>) -> Self
pub fn filter_if_some<F>(self, opt: Option<F>) -> Self
Add a filter conditionally if the option is Some.
Trait Implementations§
Source§impl Clone for FluentFilterBuilder
impl Clone for FluentFilterBuilder
Source§fn clone(&self) -> FluentFilterBuilder
fn clone(&self) -> FluentFilterBuilder
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FluentFilterBuilder
impl Debug for FluentFilterBuilder
Auto Trait Implementations§
impl Freeze for FluentFilterBuilder
impl RefUnwindSafe for FluentFilterBuilder
impl Send for FluentFilterBuilder
impl Sync for FluentFilterBuilder
impl Unpin for FluentFilterBuilder
impl UnwindSafe for FluentFilterBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)