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)
| 10978 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 10979 | // or updated by the mutation. |
| 10980 | func (m *ProjectMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { |
| 10981 | switch { |
| 10982 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 10983 | id, exists := m.ID() |
| 10984 | if exists { |
| 10985 | return []uuid.UUID{id}, nil |
| 10986 | } |
| 10987 | fallthrough |
| 10988 | case m.op.Is(OpUpdate | OpDelete): |
| 10989 | return m.Client().Project.Query().Where(m.predicates...).IDs(ctx) |
| 10990 | default: |
| 10991 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 10992 | } |
| 10993 | } |
| 10994 | |
| 10995 | // SetName sets the "name" field. |
| 10996 | func (m *ProjectMutation) SetName(s string) { |