1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::dsl;
use crate::expression::Expression;
use crate::expression::TypedExpressionType;
use crate::expression::ValidGrouping;
use crate::query_builder::FromClause;
use crate::query_builder::{AsQuery, SelectStatement};
use crate::query_source::Table;
pub trait GroupByDsl<Expr: Expression> {
type Output;
fn group_by(self, expr: Expr) -> dsl::GroupBy<Self, Expr>;
}
impl<T, Expr> GroupByDsl<Expr> for T
where
Expr: Expression,
T: Table + AsQuery<Query = SelectStatement<FromClause<T>>>,
T::DefaultSelection: Expression<SqlType = T::SqlType> + ValidGrouping<()>,
T::SqlType: TypedExpressionType,
T::Query: GroupByDsl<Expr>,
{
type Output = dsl::GroupBy<SelectStatement<FromClause<T>>, Expr>;
fn group_by(self, expr: Expr) -> dsl::GroupBy<Self, Expr> {
self.as_query().group_by(expr)
}
}