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

Method GroupBy

pkg/database/ent/alert_query.go:419–426  ·  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.Alert.Query(). GroupBy(ale

(field string, fields ...string)

Source from the content-addressed store, hash-verified

417// Aggregate(ent.Count()).
418// Scan(ctx, &v)
419func (_q *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy {
420 _q.ctx.Fields = append([]string{field}, fields...)
421 grbuild := &AlertGroupBy{build: _q}
422 grbuild.flds = &_q.ctx.Fields
423 grbuild.label = alert.Label
424 grbuild.scan = grbuild.Scan
425 return grbuild
426}
427
428// Select allows the selection one or more fields/columns for the given query,
429// instead of selecting all fields in the entity.

Callers 1

sqlScanMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected