Derive Macro diesel::expression::ValidGrouping[][src]

    // Attributes available to this derive:

Implements ValidGrouping

This trait can be automatically derived for structs with no type parameters which are never aggregate, as well as for structs which are NonAggregate when all type parameters are NonAggregate. For example:

struct LiteralOne;

struct Plus<Lhs, Rhs>(Lhs, Rhs);

// The following impl will be generated:

impl<GroupByClause> ValidGrouping<GroupByClause> for LiteralOne {
    type IsAggregate = is_aggregate::Never;

impl<Lhs, Rhs, GroupByClause> ValidGrouping<GroupByClause> for Plus<Lhs, Rhs>
    Lhs: ValidGrouping<GroupByClause>,
    Rhs: ValidGrouping<GroupByClause>,
    Lhs::IsAggregate: MixedAggregates<Rhs::IsAggregate>,
    type IsAggregate = <Lhs::IsAggregate as MixedAggregates<Rhs::IsAggregate>>::Output;

For types which are always considered aggregate (such as an aggregate function), annotate your struct with #[diesel(aggregate)] to set IsAggregate explicitly to is_aggregate::Yes.


Optional container attributes