IDs executes the query and returns a list of Entity IDs.
(ctx context.Context)
| 251 | |
| 252 | // IDs executes the query and returns a list of Entity IDs. |
| 253 | func (eq *EntityQuery) IDs(ctx context.Context) (ids []int, err error) { |
| 254 | if eq.ctx.Unique == nil && eq.path != nil { |
| 255 | eq.Unique(true) |
| 256 | } |
| 257 | ctx = setContextOp(ctx, eq.ctx, "IDs") |
| 258 | if err = eq.Select(entity.FieldID).Scan(ctx, &ids); err != nil { |
| 259 | return nil, err |
| 260 | } |
| 261 | return ids, nil |
| 262 | } |
| 263 | |
| 264 | // IDsX is like IDs, but panics if an error occurs. |
| 265 | func (eq *EntityQuery) IDsX(ctx context.Context) []int { |