MCPcopy
hub / github.com/crowdsecurity/crowdsec / Select

Method Select

pkg/database/ent/meta_query.go:330–336  ·  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.Meta.Query(). Select(meta.FieldCreatedAt). Scan(ctx, &v)

(fields ...string)

Source from the content-addressed store, hash-verified

328// Select(meta.FieldCreatedAt).
329// Scan(ctx, &v)
330func (_q *MetaQuery) Select(fields ...string) *MetaSelect {
331 _q.ctx.Fields = append(_q.ctx.Fields, fields...)
332 sbuild := &MetaSelect{MetaQuery: _q}
333 sbuild.label = meta.Label
334 sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
335 return sbuild
336}
337
338// Aggregate returns a MetaSelect configured with the given aggregations.
339func (_q *MetaQuery) Aggregate(fns ...AggregateFunc) *MetaSelect {

Callers 11

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

Calls

no outgoing calls

Tested by

no test coverage detected