diesel/query_dsl/
distinct_dsl.rs1#[cfg(feature = "postgres")]
2use expression::SelectableExpression;
3use query_source::Table;
4
5pub trait DistinctDsl {
13 type Output;
15
16 fn distinct(self) -> Self::Output;
18}
19
20impl<T> DistinctDsl for T
21where
22 T: Table,
23 T::Query: DistinctDsl,
24{
25 type Output = <T::Query as DistinctDsl>::Output;
26
27 fn distinct(self) -> Self::Output {
28 self.as_query().distinct()
29 }
30}
31
32#[cfg(feature = "postgres")]
40pub trait DistinctOnDsl<Selection> {
41 type Output;
43
44 fn distinct_on(self, selection: Selection) -> Self::Output;
46}
47
48#[cfg(feature = "postgres")]
49impl<T, Selection> DistinctOnDsl<Selection> for T
50where
51 Selection: SelectableExpression<T>,
52 T: Table,
53 T::Query: DistinctOnDsl<Selection>,
54{
55 type Output = <T::Query as DistinctOnDsl<Selection>>::Output;
56
57 fn distinct_on(self, selection: Selection) -> Self::Output {
58 self.as_query().distinct_on(selection)
59 }
60}