pub trait Query:
Debug
+ Serialize
+ MaybeSend
+ MaybeSync {
// Provided methods
fn filter(&self) -> Option<RestSql> { ... }
fn pagination(&self) -> Option<Pagination> { ... }
fn default_sort() -> Option<Vec<Sorter>>
where Self: Sized { ... }
fn sort(&self) -> Option<Vec<Sorter>>
where Self: Sized { ... }
}Expand description
Query abstraction for read-side storage.
All three methods have default implementations so minimal structs need zero boilerplate:
ⓘ
#[derive(Debug, Serialize, Deserialize)]
struct GameQuery { category: Option<String>, available: Option<bool> }
impl Query for GameQuery {}The default filter() converts every non-None field to an equality
constraint (field == value) ANDed together. Override only when you need
non-equality operators (Gte, Like, …) or field-name remapping.
Provided Methods§
Sourcefn filter(&self) -> Option<RestSql>
fn filter(&self) -> Option<RestSql>
Returns a filter derived from the struct’s serializable fields.
Override when you need operators other than == or custom field names.
Sourcefn pagination(&self) -> Option<Pagination>
fn pagination(&self) -> Option<Pagination>
Pagination hint for the storage layer. Defaults to None (let the
storage use its own defaults or rely on CqrsHttpQuery page params).
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.