Struct rust_query::group::GroupQuery
source · pub struct GroupQuery<'outer, 'inner> { /* private fields */ }
Expand description
This is the query type used in sub-queries. It can only produce one result (for each outer result). This type dereferences to Query.
Implementations§
source§impl<'outer, 'inner> GroupQuery<'outer, 'inner>
impl<'outer, 'inner> GroupQuery<'outer, 'inner>
sourcepub fn filter_on<T: MyIdenT>(
&mut self,
val: impl Value<'inner, Typ = T>,
on: impl Value<'outer, Typ = T>
)
pub fn filter_on<T: MyIdenT>( &mut self, val: impl Value<'inner, Typ = T>, on: impl Value<'outer, Typ = T> )
Filter the rows of this sub-query based on a value from the outer query.
sourcepub fn avg<V: Value<'inner, Typ = i64>>(
&'inner self,
val: V
) -> Db<'outer, Option<i64>>
pub fn avg<V: Value<'inner, Typ = i64>>( &'inner self, val: V ) -> Db<'outer, Option<i64>>
Return the average value in a column, this is None if there are zero rows.
sourcepub fn max<V: Value<'inner, Typ = i64>>(
&'inner self,
val: V
) -> Db<'outer, Option<i64>>
pub fn max<V: Value<'inner, Typ = i64>>( &'inner self, val: V ) -> Db<'outer, Option<i64>>
Return the maximum value in a column, this is None if there are zero rows.
sourcepub fn sum_float<V: Value<'inner, Typ = f64>>(
&'inner self,
val: V
) -> UnwrapOr<Db<'outer, Option<f64>>, f64>
pub fn sum_float<V: Value<'inner, Typ = f64>>( &'inner self, val: V ) -> UnwrapOr<Db<'outer, Option<f64>>, f64>
Return the sum of a column.
Methods from Deref<Target = Query<'inner>>§
sourcepub fn table<T: HasId>(&mut self, t: T) -> Db<'inner, T>
pub fn table<T: HasId>(&mut self, t: T) -> Db<'inner, T>
Join a table, this is like Iterator::flat_map but for queries.
sourcepub fn flat_table<T: Table>(&mut self, t: T) -> T::Dummy<'inner>
pub fn flat_table<T: Table>(&mut self, t: T) -> T::Dummy<'inner>
Join a table that has no integer primary key. Refer to Query::table for more information about joining tables.
sourcepub fn query<F, R>(&self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a mut GroupQuery<'inner, 'a>) -> R,
pub fn query<F, R>(&self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a mut GroupQuery<'inner, 'a>) -> R,
Perform a sub-query that returns a single result for each of the current rows.
Trait Implementations§
source§impl<'outer, 'inner> Deref for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> Deref for GroupQuery<'outer, 'inner>
Auto Trait Implementations§
impl<'outer, 'inner> Freeze for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> !RefUnwindSafe for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> !Send for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> !Sync for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> !Unpin for GroupQuery<'outer, 'inner>
impl<'outer, 'inner> !UnwindSafe for GroupQuery<'outer, 'inner>
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