MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / IDs

Method IDs

ent/mutation.go:12632–12645  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

12630// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
12631// or updated by the mutation.
12632func (m *StoragePolicyMutation) IDs(ctx context.Context) ([]int, error) {
12633 switch {
12634 case m.op.Is(OpUpdateOne | OpDeleteOne):
12635 id, exists := m.ID()
12636 if exists {
12637 return []int{id}, nil
12638 }
12639 fallthrough
12640 case m.op.Is(OpUpdate | OpDelete):
12641 return m.Client().StoragePolicy.Query().Where(m.predicates...).IDs(ctx)
12642 default:
12643 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
12644 }
12645}
12646
12647// SetCreatedAt sets the "created_at" field.
12648func (m *StoragePolicyMutation) SetCreatedAt(t time.Time) {

Callers

nothing calls this directly

Calls 5

IDMethod · 0.95
ClientMethod · 0.95
IDsMethod · 0.45
WhereMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected