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.Alert.Query(). Select(alert.FieldCreatedAt). Scan(ctx, &v)
(fields ...string)
| 438 | // Select(alert.FieldCreatedAt). |
| 439 | // Scan(ctx, &v) |
| 440 | func (_q *AlertQuery) Select(fields ...string) *AlertSelect { |
| 441 | _q.ctx.Fields = append(_q.ctx.Fields, fields...) |
| 442 | sbuild := &AlertSelect{AlertQuery: _q} |
| 443 | sbuild.label = alert.Label |
| 444 | sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan |
| 445 | return sbuild |
| 446 | } |
| 447 | |
| 448 | // Aggregate returns a AlertSelect configured with the given aggregations. |
| 449 | func (_q *AlertQuery) Aggregate(fns ...AggregateFunc) *AlertSelect { |