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.Alert.Query(). GroupBy(ale
(field string, fields ...string)
| 417 | // Aggregate(ent.Count()). |
| 418 | // Scan(ctx, &v) |
| 419 | func (_q *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy { |
| 420 | _q.ctx.Fields = append([]string{field}, fields...) |
| 421 | grbuild := &AlertGroupBy{build: _q} |
| 422 | grbuild.flds = &_q.ctx.Fields |
| 423 | grbuild.label = alert.Label |
| 424 | grbuild.scan = grbuild.Scan |
| 425 | return grbuild |
| 426 | } |
| 427 | |
| 428 | // Select allows the selection one or more fields/columns for the given query, |
| 429 | // instead of selecting all fields in the entity. |