MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / Select

Method Select

ent/entity_query.go:402–408  ·  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.Entity.Query(). Select(entity.FieldCreatedAt). Scan(ctx, &v)

(fields ...string)

Source from the content-addressed store, hash-verified

400// Select(entity.FieldCreatedAt).
401// Scan(ctx, &v)
402func (eq *EntityQuery) Select(fields ...string) *EntitySelect {
403 eq.ctx.Fields = append(eq.ctx.Fields, fields...)
404 sbuild := &EntitySelect{EntityQuery: eq}
405 sbuild.label = entity.Label
406 sbuild.flds, sbuild.scan = &eq.ctx.Fields, sbuild.Scan
407 return sbuild
408}
409
410// Aggregate returns a EntitySelect configured with the given aggregations.
411func (eq *EntityQuery) Aggregate(fns ...AggregateFunc) *EntitySelect {

Callers 6

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

Calls

no outgoing calls

Tested by

no test coverage detected