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)
| 10941 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 10942 | // or updated by the mutation. |
| 10943 | func (m *SettingMutation) IDs(ctx context.Context) ([]int, error) { |
| 10944 | switch { |
| 10945 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 10946 | id, exists := m.ID() |
| 10947 | if exists { |
| 10948 | return []int{id}, nil |
| 10949 | } |
| 10950 | fallthrough |
| 10951 | case m.op.Is(OpUpdate | OpDelete): |
| 10952 | return m.Client().Setting.Query().Where(m.predicates...).IDs(ctx) |
| 10953 | default: |
| 10954 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 10955 | } |
| 10956 | } |
| 10957 | |
| 10958 | // SetCreatedAt sets the "created_at" field. |
| 10959 | func (m *SettingMutation) SetCreatedAt(t time.Time) { |