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 { CreateTime time.Time `json:"create_time,omitempty"` Count int `json:"count,omitempty"` } client.GitCommit.Query(). Group
(field string, fields ...string)
| 312 | // Aggregate(ent.Count()). |
| 313 | // Scan(ctx, &v) |
| 314 | func (gcq *GitCommitQuery) GroupBy(field string, fields ...string) *GitCommitGroupBy { |
| 315 | gcq.ctx.Fields = append([]string{field}, fields...) |
| 316 | grbuild := &GitCommitGroupBy{build: gcq} |
| 317 | grbuild.flds = &gcq.ctx.Fields |
| 318 | grbuild.label = gitcommit.Label |
| 319 | grbuild.scan = grbuild.Scan |
| 320 | return grbuild |
| 321 | } |
| 322 | |
| 323 | // Select allows the selection one or more fields/columns for the given query, |
| 324 | // instead of selecting all fields in the entity. |