Desc applies the given fields in DESC order.
(fields ...string)
| 131 | |
| 132 | // Desc applies the given fields in DESC order. |
| 133 | func Desc(fields ...string) func(*sql.Selector) { |
| 134 | return func(s *sql.Selector) { |
| 135 | for _, f := range fields { |
| 136 | if err := checkColumn(s.TableName(), f); err != nil { |
| 137 | s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)}) |
| 138 | } |
| 139 | s.OrderBy(sql.Desc(s.C(f))) |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // AggregateFunc applies an aggregation step on the group-by traversal/selector. |
| 145 | type AggregateFunc func(*sql.Selector) string |
no test coverage detected