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)
| 9156 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 9157 | // or updated by the mutation. |
| 9158 | func (m *OrganizationMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { |
| 9159 | switch { |
| 9160 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 9161 | id, exists := m.ID() |
| 9162 | if exists { |
| 9163 | return []uuid.UUID{id}, nil |
| 9164 | } |
| 9165 | fallthrough |
| 9166 | case m.op.Is(OpUpdate | OpDelete): |
| 9167 | return m.Client().Organization.Query().Where(m.predicates...).IDs(ctx) |
| 9168 | default: |
| 9169 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 9170 | } |
| 9171 | } |
| 9172 | |
| 9173 | // SetName sets the "name" field. |
| 9174 | func (m *OrganizationMutation) SetName(s string) { |