withFileID sets the ID field of the mutation.
(id int)
| 3035 | |
| 3036 | // withFileID sets the ID field of the mutation. |
| 3037 | func 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. |
| 3059 | func withFile(node *File) fileOption { |
no test coverage detected