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

Method IDs

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

3098// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
3099// or updated by the mutation.
3100func (m *FileMutation) IDs(ctx context.Context) ([]int, error) {
3101 switch {
3102 case m.op.Is(OpUpdateOne | OpDeleteOne):
3103 id, exists := m.ID()
3104 if exists {
3105 return []int{id}, nil
3106 }
3107 fallthrough
3108 case m.op.Is(OpUpdate | OpDelete):
3109 return m.Client().File.Query().Where(m.predicates...).IDs(ctx)
3110 default:
3111 return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
3112 }
3113}
3114
3115// SetCreatedAt sets the "created_at" field.
3116func (m *FileMutation) SetCreatedAt(t time.Time) {

Callers 15

IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45
IDsMethod · 0.45

Calls 4

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

Tested by

no test coverage detected