MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / GroupBy

Method GroupBy

pkg/database/ent/event_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.Event.Query(). GroupBy(eve

(field string, fields ...string)

Source from the content-addressed store, hash-verified

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

sqlScanMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected