IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
(ctx context.Context)
| 14326 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 14327 | // or updated by the mutation. |
| 14328 | func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { |
| 14329 | switch { |
| 14330 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 14331 | id, exists := m.ID() |
| 14332 | if exists { |
| 14333 | return []uuid.UUID{id}, nil |
| 14334 | } |
| 14335 | fallthrough |
| 14336 | case m.op.Is(OpUpdate | OpDelete): |
| 14337 | return m.Client().User.Query().Where(m.predicates...).IDs(ctx) |
| 14338 | default: |
| 14339 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 14340 | } |
| 14341 | } |
| 14342 | |
| 14343 | // SetEmail sets the "email" field. |
| 14344 | func (m *UserMutation) SetEmail(s string) { |