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)
| 400 | // Select(entity.FieldCreatedAt). |
| 401 | // Scan(ctx, &v) |
| 402 | func (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. |
| 411 | func (eq *EntityQuery) Aggregate(fns ...AggregateFunc) *EntitySelect { |