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)
| 3255 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 3256 | // or updated by the mutation. |
| 3257 | func (m *CASMappingMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { |
| 3258 | switch { |
| 3259 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 3260 | id, exists := m.ID() |
| 3261 | if exists { |
| 3262 | return []uuid.UUID{id}, nil |
| 3263 | } |
| 3264 | fallthrough |
| 3265 | case m.op.Is(OpUpdate | OpDelete): |
| 3266 | return m.Client().CASMapping.Query().Where(m.predicates...).IDs(ctx) |
| 3267 | default: |
| 3268 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 3269 | } |
| 3270 | } |
| 3271 | |
| 3272 | // SetDigest sets the "digest" field. |
| 3273 | func (m *CASMappingMutation) SetDigest(s string) { |