pub trait Filterable: Sized {
Show 25 methods
// Required methods
fn filters_mut(&mut self) -> &mut Vec<FilterCondition>;
fn params_mut(&mut self) -> &mut ParamStore;
// Provided methods
fn eq(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn neq(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn gt(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn gte(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn lt(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn lte(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn like(self, column: &str, pattern: impl IntoSqlParam) -> Self { ... }
fn ilike(self, column: &str, pattern: impl IntoSqlParam) -> Self { ... }
fn is(self, column: &str, value: IsValue) -> Self { ... }
fn in_<V>(self, column: &str, values: Vec<V>) -> Self
where V: IntoSqlParam { ... }
fn contains(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn contained_by(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn overlaps(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn range_gt(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn range_gte(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn range_lt(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn range_lte(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn range_adjacent(self, column: &str, value: impl IntoSqlParam) -> Self { ... }
fn text_search(
self,
column: &str,
query: impl IntoSqlParam,
search_type: TextSearchType,
config: Option<&str>,
) -> Self { ... }
fn not(
self,
f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>,
) -> Self { ... }
fn or_filter(
self,
f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>,
) -> Self { ... }
fn match_filter(self, pairs: Vec<(&str, impl IntoSqlParam + Clone)>) -> Self { ... }
fn filter(self, raw_sql: &str) -> Self { ... }
}Expand description
Trait providing all filter methods for query builders.
Implementors must provide access to the internal filter list and param store.
Required Methods§
Sourcefn filters_mut(&mut self) -> &mut Vec<FilterCondition>
fn filters_mut(&mut self) -> &mut Vec<FilterCondition>
Get a mutable reference to the filter list.
Sourcefn params_mut(&mut self) -> &mut ParamStore
fn params_mut(&mut self) -> &mut ParamStore
Get a mutable reference to the parameter store.
Provided Methods§
Sourcefn eq(self, column: &str, value: impl IntoSqlParam) -> Self
fn eq(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column = value
Sourcefn neq(self, column: &str, value: impl IntoSqlParam) -> Self
fn neq(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column != value
Sourcefn gt(self, column: &str, value: impl IntoSqlParam) -> Self
fn gt(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column > value
Sourcefn gte(self, column: &str, value: impl IntoSqlParam) -> Self
fn gte(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column >= value
Sourcefn lt(self, column: &str, value: impl IntoSqlParam) -> Self
fn lt(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column < value
Sourcefn lte(self, column: &str, value: impl IntoSqlParam) -> Self
fn lte(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column <= value
Sourcefn like(self, column: &str, pattern: impl IntoSqlParam) -> Self
fn like(self, column: &str, pattern: impl IntoSqlParam) -> Self
Filter: column LIKE pattern
Sourcefn ilike(self, column: &str, pattern: impl IntoSqlParam) -> Self
fn ilike(self, column: &str, pattern: impl IntoSqlParam) -> Self
Filter: column ILIKE pattern (case-insensitive)
Sourcefn is(self, column: &str, value: IsValue) -> Self
fn is(self, column: &str, value: IsValue) -> Self
Filter: column IS NULL / IS NOT NULL / IS TRUE / IS FALSE
Sourcefn in_<V>(self, column: &str, values: Vec<V>) -> Selfwhere
V: IntoSqlParam,
fn in_<V>(self, column: &str, values: Vec<V>) -> Selfwhere
V: IntoSqlParam,
Filter: column IN (val1, val2, …)
Sourcefn contains(self, column: &str, value: impl IntoSqlParam) -> Self
fn contains(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column @> value (contains)
Sourcefn contained_by(self, column: &str, value: impl IntoSqlParam) -> Self
fn contained_by(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column <@ value (contained by)
Sourcefn overlaps(self, column: &str, value: impl IntoSqlParam) -> Self
fn overlaps(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column && value (overlaps)
Sourcefn range_gt(self, column: &str, value: impl IntoSqlParam) -> Self
fn range_gt(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column >> value (range strictly greater than)
Sourcefn range_gte(self, column: &str, value: impl IntoSqlParam) -> Self
fn range_gte(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column &> value (range greater than or equal)
Sourcefn range_lt(self, column: &str, value: impl IntoSqlParam) -> Self
fn range_lt(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column << value (range strictly less than)
Sourcefn range_lte(self, column: &str, value: impl IntoSqlParam) -> Self
fn range_lte(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column &< value (range less than or equal)
Sourcefn range_adjacent(self, column: &str, value: impl IntoSqlParam) -> Self
fn range_adjacent(self, column: &str, value: impl IntoSqlParam) -> Self
Filter: column -|- value (range adjacent)
Sourcefn text_search(
self,
column: &str,
query: impl IntoSqlParam,
search_type: TextSearchType,
config: Option<&str>,
) -> Self
fn text_search( self, column: &str, query: impl IntoSqlParam, search_type: TextSearchType, config: Option<&str>, ) -> Self
Full-text search filter.
Sourcefn not(self, f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>) -> Self
fn not(self, f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>) -> Self
Negate a filter condition using a closure.
Sourcefn or_filter(
self,
f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>,
) -> Self
fn or_filter( self, f: impl FnOnce(FilterCollector<'_>) -> FilterCollector<'_>, ) -> Self
OR filter: combine multiple conditions with OR.
Sourcefn match_filter(self, pairs: Vec<(&str, impl IntoSqlParam + Clone)>) -> Self
fn match_filter(self, pairs: Vec<(&str, impl IntoSqlParam + Clone)>) -> Self
Match multiple column=value pairs (all must match).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.