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

Method IDs

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

11535// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
11536// or updated by the mutation.
11537func (m *ShareMutation) IDs(ctx context.Context) ([]int, error) {
11538 switch {
11539 case m.op.Is(OpUpdateOne | OpDeleteOne):
11540 id, exists := m.ID()
11541 if exists {
11542 return []int{id}, nil
11543 }
11544 fallthrough
11545 case m.op.Is(OpUpdate | OpDelete):
11546 return m.Client().Share.Query().Where(m.predicates...).IDs(ctx)
11547 default:
11548 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
11549 }
11550}
11551
11552// SetCreatedAt sets the "created_at" field.
11553func (m *ShareMutation) 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