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

Function withFileID

ent/mutation.go:3037–3056  ·  view source on GitHub ↗

withFileID sets the ID field of the mutation.

(id int)

Source from the content-addressed store, hash-verified

3035
3036// withFileID sets the ID field of the mutation.
3037func withFileID(id int) fileOption {
3038 return func(m *FileMutation) {
3039 var (
3040 err error
3041 once sync.Once
3042 value *File
3043 )
3044 m.oldValue = func(ctx context.Context) (*File, error) {
3045 once.Do(func() {
3046 if m.done {
3047 err = errors.New("querying old values post mutation is not allowed")
3048 } else {
3049 value, err = m.Client().File.Get(ctx, id)
3050 }
3051 })
3052 return value, err
3053 }
3054 m.id = &id
3055 }
3056}
3057
3058// withFile sets the old File of the mutation.
3059func withFile(node *File) fileOption {

Callers 1

UpdateOneIDMethod · 0.85

Calls 4

DoMethod · 0.65
NewMethod · 0.65
GetMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected