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.Task.Query(). Select(task.FieldCreatedAt). Scan(ctx, &v)
(fields ...string)
| 327 | // Select(task.FieldCreatedAt). |
| 328 | // Scan(ctx, &v) |
| 329 | func (tq *TaskQuery) Select(fields ...string) *TaskSelect { |
| 330 | tq.ctx.Fields = append(tq.ctx.Fields, fields...) |
| 331 | sbuild := &TaskSelect{TaskQuery: tq} |
| 332 | sbuild.label = task.Label |
| 333 | sbuild.flds, sbuild.scan = &tq.ctx.Fields, sbuild.Scan |
| 334 | return sbuild |
| 335 | } |
| 336 | |
| 337 | // Aggregate returns a TaskSelect configured with the given aggregations. |
| 338 | func (tq *TaskQuery) Aggregate(fns ...AggregateFunc) *TaskSelect { |