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)
| 7831 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 7832 | // or updated by the mutation. |
| 7833 | func (m *EventMutation) IDs(ctx context.Context) ([]int, error) { |
| 7834 | switch { |
| 7835 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 7836 | id, exists := m.ID() |
| 7837 | if exists { |
| 7838 | return []int{id}, nil |
| 7839 | } |
| 7840 | fallthrough |
| 7841 | case m.op.Is(OpUpdate | OpDelete): |
| 7842 | return m.Client().Event.Query().Where(m.predicates...).IDs(ctx) |
| 7843 | default: |
| 7844 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 7845 | } |
| 7846 | } |
| 7847 | |
| 7848 | // SetCreatedAt sets the "created_at" field. |
| 7849 | func (m *EventMutation) SetCreatedAt(t time.Time) { |