Mean applies the "mean" aggregation function on the given field of each group.
(field string)
| 175 | |
| 176 | // Mean applies the "mean" aggregation function on the given field of each group. |
| 177 | func Mean(field string) AggregateFunc { |
| 178 | return func(s *sql.Selector) string { |
| 179 | if err := checkColumn(s.TableName(), field); err != nil { |
| 180 | s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)}) |
| 181 | return "" |
| 182 | } |
| 183 | return sql.Avg(s.C(field)) |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | // Min applies the "min" aggregation function on the given field of each group. |
| 188 | func Min(field string) AggregateFunc { |
nothing calls this directly
no test coverage detected