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,
pub base_conditions: Vec<String>,
}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.
base_conditions: Vec<String>Base conditions that are always applied (e.g., soft delete exclusion) These are raw SQL conditions that will be ANDed with other conditions
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 add_base_condition(&mut self, condition: String)
pub fn add_base_condition(&mut self, condition: String)
Add a base condition (raw SQL that is always ANDed with other conditions) Used for soft delete exclusion, tenant filtering, etc.
Sourcepub fn build_where_clause(&self) -> (String, Vec<String>)
pub fn build_where_clause(&self) -> (String, Vec<String>)
Build the complete WHERE clause
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 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