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

Method IDs

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

1827// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
1828// or updated by the mutation.
1829func (m *EntityMutation) IDs(ctx context.Context) ([]int, error) {
1830 switch {
1831 case m.op.Is(OpUpdateOne | OpDeleteOne):
1832 id, exists := m.ID()
1833 if exists {
1834 return []int{id}, nil
1835 }
1836 fallthrough
1837 case m.op.Is(OpUpdate | OpDelete):
1838 return m.Client().Entity.Query().Where(m.predicates...).IDs(ctx)
1839 default:
1840 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
1841 }
1842}
1843
1844// SetCreatedAt sets the "created_at" field.
1845func (m *EntityMutation) 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