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.Setting.Query(). Select(setting.FieldCreatedAt). Scan(ctx, &v)
(fields ...string)
| 291 | // Select(setting.FieldCreatedAt). |
| 292 | // Scan(ctx, &v) |
| 293 | func (sq *SettingQuery) Select(fields ...string) *SettingSelect { |
| 294 | sq.ctx.Fields = append(sq.ctx.Fields, fields...) |
| 295 | sbuild := &SettingSelect{SettingQuery: sq} |
| 296 | sbuild.label = setting.Label |
| 297 | sbuild.flds, sbuild.scan = &sq.ctx.Fields, sbuild.Scan |
| 298 | return sbuild |
| 299 | } |
| 300 | |
| 301 | // Aggregate returns a SettingSelect configured with the given aggregations. |
| 302 | func (sq *SettingQuery) Aggregate(fns ...AggregateFunc) *SettingSelect { |