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)
| 1366 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 1367 | // or updated by the mutation. |
| 1368 | func (m *AttestationMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { |
| 1369 | switch { |
| 1370 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 1371 | id, exists := m.ID() |
| 1372 | if exists { |
| 1373 | return []uuid.UUID{id}, nil |
| 1374 | } |
| 1375 | fallthrough |
| 1376 | case m.op.Is(OpUpdate | OpDelete): |
| 1377 | return m.Client().Attestation.Query().Where(m.predicates...).IDs(ctx) |
| 1378 | default: |
| 1379 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 1380 | } |
| 1381 | } |
| 1382 | |
| 1383 | // SetCreatedAt sets the "created_at" field. |
| 1384 | func (m *AttestationMutation) SetCreatedAt(t time.Time) { |