pub struct Aggregate<'outer, 'inner, S> { /* private fields */ }
Expand description
This is the argument type used for aggregates.
While it is possible to join many tables in an aggregate, there can be only one result. (The result can be a tuple or struct with multiple values though).
Implementations§
Source§impl<'outer: 'inner, 'inner, S: 'outer> Aggregate<'outer, 'inner, S>
impl<'outer: 'inner, 'inner, S: 'outer> Aggregate<'outer, 'inner, S>
Sourcepub fn filter_on<T>(
&mut self,
val: impl IntoColumn<'inner, S, Typ = T>,
on: impl IntoColumn<'outer, S, Typ = T>,
)
pub fn filter_on<T>( &mut self, val: impl IntoColumn<'inner, S, Typ = T>, on: impl IntoColumn<'outer, S, Typ = T>, )
Filter the rows of this sub-query based on a value from the outer query.
Sourcepub fn avg(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = f64>,
) -> Column<'outer, S, Option<f64>>
pub fn avg( &'inner self, val: impl IntoColumn<'inner, S, Typ = f64>, ) -> Column<'outer, S, Option<f64>>
Return the average value in a column, this is None if there are zero rows.
Sourcepub fn max<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, Option<T>>where
T: NumTyp,
pub fn max<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, Option<T>>where
T: NumTyp,
Return the maximum value in a column, this is None if there are zero rows.
Sourcepub fn sum<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, T>where
T: NumTyp,
pub fn sum<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, T>where
T: NumTyp,
Return the sum of a column.
Sourcepub fn count_distinct<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, i64>where
T: EqTyp,
pub fn count_distinct<T>(
&'inner self,
val: impl IntoColumn<'inner, S, Typ = T>,
) -> Column<'outer, S, i64>where
T: EqTyp,
Return the number of distinct values in a column.
Methods from Deref<Target = Rows<'inner, S>>§
Sourcepub fn join<T: Table<Schema = S>>(&mut self) -> Column<'inner, S, T>
pub fn join<T: Table<Schema = S>>(&mut self) -> Column<'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”)
For convenience there is also Table::join.
Sourcepub fn filter(&mut self, prop: impl IntoColumn<'inner, S, Typ = bool>)
pub fn filter(&mut self, prop: impl IntoColumn<'inner, S, Typ = bool>)
Filter rows based on a column.
Sourcepub fn filter_some<Typ>(
&mut self,
val: impl IntoColumn<'inner, S, Typ = Option<Typ>>,
) -> Column<'inner, S, Typ>
pub fn filter_some<Typ>( &mut self, val: impl IntoColumn<'inner, S, Typ = Option<Typ>>, ) -> Column<'inner, S, Typ>
Filter out rows where this column is None.
Returns a new column with the unwrapped type.