pub struct QueryBuilder<S>where
S: Schema,{ /* private fields */ }Expand description
Typed query builder for OData queries.
This builder provides a fluent API for constructing ODataQuery instances
with type-safe field references and automatic filter hashing.
§Example
ⓘ
let query = QueryBuilder::<UserSchema>::new()
.filter(NAME.contains("john"))
.order_by(NAME, SortDir::Asc)
.select([NAME, EMAIL])
.page_size(50)
.build();Implementations§
Source§impl<S> QueryBuilder<S>where
S: Schema,
impl<S> QueryBuilder<S>where
S: Schema,
Sourcepub fn new() -> QueryBuilder<S>
pub fn new() -> QueryBuilder<S>
Create a new empty query builder.
Sourcepub fn filter(self, expr: Expr) -> QueryBuilder<S>
pub fn filter(self, expr: Expr) -> QueryBuilder<S>
Sourcepub fn order_by<F>(self, field: F, dir: SortDir) -> QueryBuilder<S>where
F: AsFieldName,
pub fn order_by<F>(self, field: F, dir: SortDir) -> QueryBuilder<S>where
F: AsFieldName,
Sourcepub fn select<I>(self, fields: I) -> QueryBuilder<S>
pub fn select<I>(self, fields: I) -> QueryBuilder<S>
Sourcepub fn page_size(self, limit: u64) -> QueryBuilder<S>
pub fn page_size(self, limit: u64) -> QueryBuilder<S>
Sourcepub fn build(self) -> ODataQuery
pub fn build(self) -> ODataQuery
Build the final ODataQuery with computed filter hash.
The filter hash is computed using the stable hashing algorithm from
pagination::short_filter_hash.
Trait Implementations§
Source§impl<S> Default for QueryBuilder<S>where
S: Schema,
impl<S> Default for QueryBuilder<S>where
S: Schema,
Source§fn default() -> QueryBuilder<S>
fn default() -> QueryBuilder<S>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<S> Freeze for QueryBuilder<S>
impl<S> RefUnwindSafe for QueryBuilder<S>
impl<S> Send for QueryBuilder<S>
impl<S> Sync for QueryBuilder<S>
impl<S> Unpin for QueryBuilder<S>
impl<S> UnwindSafe for QueryBuilder<S>
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
Mutably borrows from an owned value. Read more
Source§impl<T> WithSecurityContext for T
impl<T> WithSecurityContext for T
Source§fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>
fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>
Binds a security context to this client, returning a
Secured wrapper. Read more