MCPcopy Create free account
hub / github.com/efectn/go-orm-benchmarks / Select

Method Select

bench/ent/model_query.go:293–299  ·  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 { Name string `json:"name,omitempty"` } client.Model.Query(). Select(model.FieldName). Scan(ctx, &v)

(fields ...string)

Source from the content-addressed store, hash-verified

291// Select(model.FieldName).
292// Scan(ctx, &v)
293func (mq *ModelQuery) Select(fields ...string) *ModelSelect {
294 mq.ctx.Fields = append(mq.ctx.Fields, fields...)
295 sbuild := &ModelSelect{ModelQuery: mq}
296 sbuild.label = model.Label
297 sbuild.flds, sbuild.scan = &mq.ctx.Fields, sbuild.Scan
298 return sbuild
299}
300
301// Aggregate returns a ModelSelect configured with the given aggregations.
302func (mq *ModelQuery) Aggregate(fns ...AggregateFunc) *ModelSelect {

Callers 14

IDsMethod · 0.95
AggregateMethod · 0.95
ReadMethod · 0.45
ReadSliceMethod · 0.45
ReadSliceMethod · 0.45
ReadMethod · 0.45
ReadSliceMethod · 0.45
ReadMethod · 0.45
ReadSliceMethod · 0.45
ReadMethod · 0.45
ReadSliceMethod · 0.45
sqlQueryMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected