GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum. Example: var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Setting.Query(). GroupBy(s
(field string, fields ...string)
| 270 | // Aggregate(ent.Count()). |
| 271 | // Scan(ctx, &v) |
| 272 | func (sq *SettingQuery) GroupBy(field string, fields ...string) *SettingGroupBy { |
| 273 | sq.ctx.Fields = append([]string{field}, fields...) |
| 274 | grbuild := &SettingGroupBy{build: sq} |
| 275 | grbuild.flds = &sq.ctx.Fields |
| 276 | grbuild.label = setting.Label |
| 277 | grbuild.scan = grbuild.Scan |
| 278 | return grbuild |
| 279 | } |
| 280 | |
| 281 | // Select allows the selection one or more fields/columns for the given query, |
| 282 | // instead of selecting all fields in the entity. |