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

Method IDs

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

7233// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
7234// or updated by the mutation.
7235func (m *NodeMutation) IDs(ctx context.Context) ([]int, error) {
7236 switch {
7237 case m.op.Is(OpUpdateOne | OpDeleteOne):
7238 id, exists := m.ID()
7239 if exists {
7240 return []int{id}, nil
7241 }
7242 fallthrough
7243 case m.op.Is(OpUpdate | OpDelete):
7244 return m.Client().Node.Query().Where(m.predicates...).IDs(ctx)
7245 default:
7246 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
7247 }
7248}
7249
7250// SetCreatedAt sets the "created_at" field.
7251func (m *NodeMutation) 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