pub struct QueryBuilder { /* private fields */ }Expand description
Builder used inside a schema crate. It is deliberately stateful: the
closure describes one plan, then finish() returns plain serializable data.
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
pub fn new(name: impl Into<String>, doc: impl Into<String>) -> Self
pub fn from<M: QueryModel>(&mut self) -> M::Fields
pub fn filter(&mut self, expr: BoolExpr)
pub fn group_by<T>(&mut self, field: &FieldExpr<T>)
pub fn field<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
pub fn count(&mut self, name: impl Into<String>) -> ColumnHandle<'_>
Sourcepub fn count_of<T>(
&mut self,
name: impl Into<String>,
field: &FieldExpr<T>,
) -> ColumnHandle<'_>
pub fn count_of<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
Count rows where the expression is non-null — the SQL COUNT(col) semantics; with a LEFT join this is how “0 related” stays 0.
pub fn count_distinct<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
pub fn sum<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
pub fn min<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
pub fn max<T>( &mut self, name: impl Into<String>, field: &FieldExpr<T>, ) -> ColumnHandle<'_>
Sourcepub fn follow_in<M: QueryModel>(
&mut self,
anchor: u32,
field: impl Into<String>,
required: bool,
) -> M::Fields
pub fn follow_in<M: QueryModel>( &mut self, anchor: u32, field: impl Into<String>, required: bool, ) -> M::Fields
JOIN: bind records of M whose OWN link field field points at the
anchor binding’s record (SQL: FROM anchor JOIN M ON M.field = anchor).
required: false is a LEFT join — anchor rows without a match keep one
row with the M binding absent. The field name is a string until slice
3’s typed EdgeExpr; the registry gate validates it at emission.
Sourcepub fn follow_out<M: QueryModel>(
&mut self,
anchor: u32,
field: impl Into<String>,
required: bool,
) -> M::Fields
pub fn follow_out<M: QueryModel>( &mut self, anchor: u32, field: impl Into<String>, required: bool, ) -> M::Fields
JOIN along a link field ON THE ANCHOR pointing out at records of M.
pub fn order_by<T>(&mut self, field: &FieldExpr<T>, direction: SortDirection)
Sourcepub fn order_by_column(&mut self, name: &str, direction: SortDirection)
pub fn order_by_column(&mut self, name: &str, direction: SortDirection)
Order by an output column’s expression (aggregates included).
pub fn limit(&mut self, limit: usize)
pub fn finish(self) -> QueryDecl
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