1- use crate :: expression:: SelectableExpression ;
1+ use crate :: expression:: { SelectableExpression , ValidGrouping } ;
22use crate :: pg:: Pg ;
3+ use crate :: query_builder:: group_by_clause:: ValidGroupByClause ;
34use crate :: query_builder:: order_clause:: NoOrderClause ;
45use crate :: query_builder:: {
5- AstPass , FromClause , QueryFragment , QueryId , SelectQuery , SelectStatement ,
6+ AstPass , FromClause , QueryFragment , QueryId , SelectClauseExpression , SelectQuery ,
7+ SelectStatement ,
68} ;
9+ use crate :: query_dsl:: group_by_dsl:: ValidDistinctForGroupBy ;
710use crate :: query_dsl:: methods:: DistinctOnDsl ;
811use crate :: query_dsl:: order_dsl:: ValidOrderingForDistinct ;
912use crate :: result:: QueryResult ;
@@ -20,6 +23,8 @@ impl<T> ValidOrderingForDistinct<DistinctOnClause<T>> for NoOrderClause {}
2023impl < T > ValidOrderingForDistinct < DistinctOnClause < T > > for OrderClause < ( T , ) > { }
2124impl < T > ValidOrderingForDistinct < DistinctOnClause < T > > for OrderClause < T > where T : crate :: Expression { }
2225
26+ impl < S , G , D > ValidDistinctForGroupBy < S , G > for DistinctOnClause < D > where ( D , S ) : ValidGrouping < G > { }
27+
2328impl < T > ValidOrderingForDistinct < DistinctOnClause < T > >
2429 for OrderClause < crate :: expression:: operators:: Asc < T > >
2530where
@@ -279,12 +284,15 @@ where
279284impl < ST , F , S , D , W , O , LOf , G , H , Selection > DistinctOnDsl < Selection >
280285 for SelectStatement < FromClause < F > , S , D , W , O , LOf , G , H >
281286where
287+ G : ValidGroupByClause ,
282288 F : QuerySource ,
283289 Selection : SelectableExpression < F > ,
284290 Self : SelectQuery < SqlType = ST > ,
285291 O : ValidOrderingForDistinct < DistinctOnClause < Selection > > ,
286292 SelectStatement < FromClause < F > , S , DistinctOnClause < Selection > , W , O , LOf , G , H > :
287293 SelectQuery < SqlType = ST > ,
294+ S : SelectClauseExpression < FromClause < F > > ,
295+ ( Selection , S :: Selection ) : ValidGrouping < G :: Expressions > ,
288296{
289297 type Output = SelectStatement < FromClause < F > , S , DistinctOnClause < Selection > , W , O , LOf , G , H > ;
290298
0 commit comments