pub struct QueryBuilder { /* private fields */ }Expand description
Fluent, programmatic construction of a QuerySpec — the typed counterpart of the WHERE-clause
text parsed by super::parser::parse_query. SELECT/FROM/JOIN/MATCH from ADR-0009 are a
separate, larger piece and still not covered by either front.
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
pub fn new() -> Self
pub fn where( self, field: impl Into<String>, op: ComparisonOp, value: Value, ) -> Self
pub fn where_any(self, build: impl FnOnce(&mut PredicateGroupBuilder)) -> Self
pub fn where_all(self, build: impl FnOnce(&mut PredicateGroupBuilder)) -> Self
pub fn search(self, text: impl Into<String>, mode: SearchMode) -> Self
Sourcepub fn order_by(
self,
field: impl Into<String>,
direction: SortDirection,
) -> Self
pub fn order_by( self, field: impl Into<String>, direction: SortDirection, ) -> Self
Sets the sort key. One key only, and a second call replaces the first — the TS
QueryBuilder.orderBy this mirrors keeps a single key too.
pub fn limit(self, limit: usize) -> Self
pub fn offset(self, offset: usize) -> Self
pub fn count(self) -> Self
pub fn sum(self, field: impl Into<String>) -> Self
pub fn avg(self, field: impl Into<String>) -> Self
pub fn min(self, field: impl Into<String>) -> Self
pub fn max(self, field: impl Into<String>) -> Self
pub fn group_by(self, field: impl Into<String>) -> Self
pub fn spec(self) -> QuerySpec
Sourcepub fn build_aggregate(self) -> (QuerySpec, AggregateSpec)
pub fn build_aggregate(self) -> (QuerySpec, AggregateSpec)
Splits the builder into its QuerySpec (predicates/search) and the AggregateSpec
accumulated by count/sum/avg/min/max — the two halves Table::aggregate expects.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnsafeUnpin for QueryBuilder
impl UnwindSafe for QueryBuilder
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