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