Debian Codegraph @

src/query_builder/order_clause.rs

raw
1 use crate::expression::{is_aggregate, ValidGrouping};
2
3 simple_clause!(
4 /// DSL node that represents that no order clause is set
5 NoOrderClause,
6 /// DSL node that represents that an order clause is set
7 OrderClause,
8 " ORDER BY "
9 );
10
11 impl<'a, DB, Expr> From<OrderClause<Expr>> for Option<Box<dyn QueryFragment<DB> + Send + 'a>>
12 where
13 DB: Backend,
14 Expr: QueryFragment<DB> + Send + 'a,
15 {
16 fn from(order: OrderClause<Expr>) -> Self {
17 Some(Box::new(order.0))
18 }
19 }
20
21 impl<DB> From<NoOrderClause> for Option<Box<dyn QueryFragment<DB> + Send + '_>>
22 where
23 DB: Backend,
24 {
25 fn from(_: NoOrderClause) -> Self {
26 None
27 }
28 }
29
30 impl<GB> ValidGrouping<GB> for NoOrderClause {
31 type IsAggregate = is_aggregate::Never;
32 }
33
34 impl<GB, Expr: ValidGrouping<GB>> ValidGrouping<GB> for OrderClause<Expr> {
35 type IsAggregate = Expr::IsAggregate;
36 }