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

Method GroupBy

ent/metadata_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.Metadata.Query(). GroupBy(

(field string, fields ...string)

Source from the content-addressed store, hash-verified

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