pub struct Query<'t, 'inner, S> { /* private fields */ }Expand description
This is the type used by the crate::Transaction::query method.
Implementations§
Source§impl<'t, 'inner, S> Query<'t, 'inner, S>
impl<'t, 'inner, S> Query<'t, 'inner, S>
Sourcepub fn into_vec<O>(&self, select: impl IntoSelect<'inner, S, Out = O>) -> Vec<O>
pub fn into_vec<O>(&self, select: impl IntoSelect<'inner, S, Out = O>) -> Vec<O>
Turn a database query into a Vec of results.
The order of rows that is returned is unstable. This means that the order may change between any two executions of the exact same query. If a specific order (or even a consistent order) is required, then you have to use something like slice::sort.
Sourcepub fn into_iter<O>(
&self,
select: impl IntoSelect<'inner, S, Out = O>,
) -> Iter<'t, O>
pub fn into_iter<O>( &self, select: impl IntoSelect<'inner, S, Out = O>, ) -> Iter<'t, O>
Turn a database query into an iterator of results.
The order of rows that is returned is unstable. This means that the order may change between any two executions of the exact same query. If a specific order (or even a consistent order) is required, then you have to use something like slice::sort. See also Self::order_by.
Sourcepub fn order_by<'q>(&'q self) -> OrderBy<'q, 't, 'inner, S>
pub fn order_by<'q>(&'q self) -> OrderBy<'q, 't, 'inner, S>
Use Self::order_by to refine the order or retrieved rows (partially). This is useful if not all rows are retrieved, e.g. for top N style queries.
Every additional call to OrderBy::asc and OrderBy::desc refines the order further.
This means that e.g. order_by().asc(category).asc(priority), will have all items
with the same category grouped together and only within the group are items sorted
by priority.
Methods from Deref<Target = Rows<'inner, S>>§
Sourcepub fn join<T: Table<Schema = S>>(
&mut self,
j: impl Joinable<'inner, Typ = T>,
) -> Expr<'inner, S, T>
pub fn join<T: Table<Schema = S>>( &mut self, j: impl Joinable<'inner, Typ = T>, ) -> Expr<'inner, S, T>
Join a table, this is like a super simple Iterator::flat_map but for queries.
After this operation Rows has rows for the combinations of each original row with each row of the table. (Also called the “Carthesian product”)
The expression that is returned refers to the joined table.