MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / GroupBy

Method GroupBy

ent/task_query.go:308–315  ·  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.Task.Query(). GroupBy(task

(field string, fields ...string)

Source from the content-addressed store, hash-verified

306// Aggregate(ent.Count()).
307// Scan(ctx, &v)
308func (tq *TaskQuery) GroupBy(field string, fields ...string) *TaskGroupBy {
309 tq.ctx.Fields = append([]string{field}, fields...)
310 grbuild := &TaskGroupBy{build: tq}
311 grbuild.flds = &tq.ctx.Fields
312 grbuild.label = task.Label
313 grbuild.scan = grbuild.Scan
314 return grbuild
315}
316
317// Select allows the selection one or more fields/columns for the given query,
318// instead of selecting all fields in the entity.

Callers 1

sqlScanMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected