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.Event.Query(). GroupBy(eve
(field string, fields ...string)
| 307 | // Aggregate(ent.Count()). |
| 308 | // Scan(ctx, &v) |
| 309 | func (_q *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy { |
| 310 | _q.ctx.Fields = append([]string{field}, fields...) |
| 311 | grbuild := &EventGroupBy{build: _q} |
| 312 | grbuild.flds = &_q.ctx.Fields |
| 313 | grbuild.label = event.Label |
| 314 | grbuild.scan = grbuild.Scan |
| 315 | return grbuild |
| 316 | } |
| 317 | |
| 318 | // Select allows the selection one or more fields/columns for the given query, |
| 319 | // instead of selecting all fields in the entity. |