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

Method Select

pkg/database/ent/machine_query.go:331–337  ·  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.Machine.Query(). Select(machine.FieldCreatedAt). Scan(ctx, &v)

(fields ...string)

Source from the content-addressed store, hash-verified

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

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