pub struct QueryFilter {
pub conditions: Vec<FilterCondition>,
pub sorts: Vec<SortSpec>,
pub search: Option<String>,
pub search_fields: Vec<String>,
pub limit: Option<u32>,
pub offset: Option<u32>,
pub page: Option<u32>,
pub cursor_after: Option<String>,
pub cursor_before: Option<String>,
pub estimate_total: bool,
/* private fields */
}Expand description
Complete query filter specification
Fields§
§conditions: Vec<FilterCondition>§sorts: Vec<SortSpec>§search: Option<String>§search_fields: Vec<String>§limit: Option<u32>§offset: Option<u32>§page: Option<u32>§cursor_after: Option<String>Keyset paging: the opaque cursor from a previous page’s
next_cursor (forward walk). Takes precedence over page/offset.
cursor_before: Option<String>Keyset paging: the opaque cursor from a previous page’s
prev_cursor (backward walk — the query inverts and the page is
reversed so it still reads forward).
estimate_total: boolReplace the exact COUNT (a full scan of the filtered set) with the planner’s row estimate. Screens that need the exact figure use the separate count endpoint.
Implementations§
Source§impl QueryFilter
impl QueryFilter
Sourcepub fn add_condition(&mut self, condition: FilterCondition)
pub fn add_condition(&mut self, condition: FilterCondition)
Add a filter condition
Sourcepub fn with_search(&mut self, search: String, fields: Vec<String>)
pub fn with_search(&mut self, search: String, fields: Vec<String>)
Set search term
Sourcepub fn with_pagination(&mut self, page: u32, limit: u32)
pub fn with_pagination(&mut self, page: u32, limit: u32)
Set pagination
Sourcepub fn base_conditions(&self) -> &[String]
pub fn base_conditions(&self) -> &[String]
The base conditions this filter carries, in the order they were added.
Sourcepub fn build_where_clause(&self) -> (String, Vec<String>)
pub fn build_where_clause(&self) -> (String, Vec<String>)
Build the complete WHERE clause.
The clause is a conjunction of independent groups: each base condition, the search,
and the caller’s own conditions. Every group is parenthesised whenever there is more
than one, so an OR inside the caller’s conditions (or inside a base condition) can
only widen its own group and never escape the soft-delete guard, the company fence or
the search. Parameters are numbered in the order the groups are emitted.
Sourcepub fn build_order_by_clause(&self) -> String
pub fn build_order_by_clause(&self) -> String
Build ORDER BY clause
Sourcepub fn has_uncast_value_conditions(&self) -> bool
pub fn has_uncast_value_conditions(&self) -> bool
True when some condition compares a value that carries no cast — see
FilterCondition::needs_value_cast. The repository answers it by reading the table’s
column types from the catalog before it builds the query.
Sourcepub fn needs_catalog_types(&self) -> bool
pub fn needs_catalog_types(&self) -> bool
Whether the table’s catalog types must be read before this filter runs: a comparison has no cast yet, or a cast names a user-defined type without its schema.
Sourcepub fn has_conditions(&self) -> bool
pub fn has_conditions(&self) -> bool
Check if has any conditions
Trait Implementations§
Source§impl Clone for QueryFilter
impl Clone for QueryFilter
Source§impl Debug for QueryFilter
impl Debug for QueryFilter
Auto Trait Implementations§
impl Freeze for QueryFilter
impl RefUnwindSafe for QueryFilter
impl Send for QueryFilter
impl Sync for QueryFilter
impl Unpin for QueryFilter
impl UnsafeUnpin for QueryFilter
impl UnwindSafe for QueryFilter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more