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)
| 8308 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 8309 | // or updated by the mutation. |
| 8310 | func (m *OAuthClientMutation) IDs(ctx context.Context) ([]int, error) { |
| 8311 | switch { |
| 8312 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 8313 | id, exists := m.ID() |
| 8314 | if exists { |
| 8315 | return []int{id}, nil |
| 8316 | } |
| 8317 | fallthrough |
| 8318 | case m.op.Is(OpUpdate | OpDelete): |
| 8319 | return m.Client().OAuthClient.Query().Where(m.predicates...).IDs(ctx) |
| 8320 | default: |
| 8321 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 8322 | } |
| 8323 | } |
| 8324 | |
| 8325 | // SetCreatedAt sets the "created_at" field. |
| 8326 | func (m *OAuthClientMutation) SetCreatedAt(t time.Time) { |