MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / GroupBy

Method GroupBy

app/controlplane/pkg/data/ent/group_query.go:350–357  ·  view source on GitHub ↗

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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Group.Query(). GroupBy(group.FieldName).

(field string, fields ...string)

Source from the content-addressed store, hash-verified

348// Aggregate(ent.Count()).
349// Scan(ctx, &v)
350func (_q *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
351 _q.ctx.Fields = append([]string{field}, fields...)
352 grbuild := &GroupGroupBy{build: _q}
353 grbuild.flds = &_q.ctx.Fields
354 grbuild.label = group.Label
355 grbuild.scan = grbuild.Scan
356 return grbuild
357}
358
359// Select allows the selection one or more fields/columns for the given query,
360// instead of selecting all fields in the entity.

Callers 1

sqlScanMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected