Ints returns list of ints from a selector. It is only allowed when selecting one field.
(ctx context.Context)
| 387 | |
| 388 | // Ints returns list of ints from a selector. It is only allowed when selecting one field. |
| 389 | func (s *selector) Ints(ctx context.Context) ([]int, error) { |
| 390 | if len(*s.flds) > 1 { |
| 391 | return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field") |
| 392 | } |
| 393 | var v []int |
| 394 | if err := s.scan(ctx, &v); err != nil { |
| 395 | return nil, err |
| 396 | } |
| 397 | return v, nil |
| 398 | } |
| 399 | |
| 400 | // IntsX is like Ints, but panics if an error occurs. |
| 401 | func (s *selector) IntsX(ctx context.Context) []int { |