MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / GroupBy

Method GroupBy

ent/node_query.go:309–316  ·  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 { CreatedAt time.Time `json:"created_at,omitempty"` Count int `json:"count,omitempty"` } client.Node.Query(). GroupBy(node

(field string, fields ...string)

Source from the content-addressed store, hash-verified

307// Aggregate(ent.Count()).
308// Scan(ctx, &v)
309func (nq *NodeQuery) GroupBy(field string, fields ...string) *NodeGroupBy {
310 nq.ctx.Fields = append([]string{field}, fields...)
311 grbuild := &NodeGroupBy{build: nq}
312 grbuild.flds = &nq.ctx.Fields
313 grbuild.label = node.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.

Callers 5

sqlScanMethod · 0.45
RecycleEntitiesMethod · 0.45
collectTrashBinFunction · 0.45
DeleteMethod · 0.45
offsetPaginationMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected