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)
| 4710 | // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated |
| 4711 | // or updated by the mutation. |
| 4712 | func (m *FsEventMutation) IDs(ctx context.Context) ([]int, error) { |
| 4713 | switch { |
| 4714 | case m.op.Is(OpUpdateOne | OpDeleteOne): |
| 4715 | id, exists := m.ID() |
| 4716 | if exists { |
| 4717 | return []int{id}, nil |
| 4718 | } |
| 4719 | fallthrough |
| 4720 | case m.op.Is(OpUpdate | OpDelete): |
| 4721 | return m.Client().FsEvent.Query().Where(m.predicates...).IDs(ctx) |
| 4722 | default: |
| 4723 | return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) |
| 4724 | } |
| 4725 | } |
| 4726 | |
| 4727 | // SetCreatedAt sets the "created_at" field. |
| 4728 | func (m *FsEventMutation) SetCreatedAt(t time.Time) { |