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

Method Select

pkg/database/ent/alert_query.go:440–446  ·  view source on GitHub ↗

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity. Example: var v []struct { CreatedAt time.Time `json:"created_at,omitempty"` } client.Alert.Query(). Select(alert.FieldCreatedAt). Scan(ctx, &v)

(fields ...string)

Source from the content-addressed store, hash-verified

438// Select(alert.FieldCreatedAt).
439// Scan(ctx, &v)
440func (_q *AlertQuery) Select(fields ...string) *AlertSelect {
441 _q.ctx.Fields = append(_q.ctx.Fields, fields...)
442 sbuild := &AlertSelect{AlertQuery: _q}
443 sbuild.label = alert.Label
444 sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
445 return sbuild
446}
447
448// Aggregate returns a AlertSelect configured with the given aggregations.
449func (_q *AlertQuery) Aggregate(fns ...AggregateFunc) *AlertSelect {

Callers 5

IDsMethod · 0.95
AggregateMethod · 0.95
sqlQueryMethod · 0.45
sqlScanMethod · 0.45
sqlScanMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected