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

Method IDs

ent/mutation.go:15187–15200  ·  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

15185// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
15186// or updated by the mutation.
15187func (m *UserMutation) IDs(ctx context.Context) ([]int, error) {
15188 switch {
15189 case m.op.Is(OpUpdateOne | OpDeleteOne):
15190 id, exists := m.ID()
15191 if exists {
15192 return []int{id}, nil
15193 }
15194 fallthrough
15195 case m.op.Is(OpUpdate | OpDelete):
15196 return m.Client().User.Query().Where(m.predicates...).IDs(ctx)
15197 default:
15198 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
15199 }
15200}
15201
15202// SetCreatedAt sets the "created_at" field.
15203func (m *UserMutation) 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