withUserID sets the ID field of the mutation.
(id uuid.UUID)
| 14257 | |
| 14258 | // withUserID sets the ID field of the mutation. |
| 14259 | func withUserID(id uuid.UUID) userOption { |
| 14260 | return func(m *UserMutation) { |
| 14261 | var ( |
| 14262 | err error |
| 14263 | once sync.Once |
| 14264 | value *User |
| 14265 | ) |
| 14266 | m.oldValue = func(ctx context.Context) (*User, error) { |
| 14267 | once.Do(func() { |
| 14268 | if m.done { |
| 14269 | err = errors.New("querying old values post mutation is not allowed") |
| 14270 | } else { |
| 14271 | value, err = m.Client().User.Get(ctx, id) |
| 14272 | } |
| 14273 | }) |
| 14274 | return value, err |
| 14275 | } |
| 14276 | m.id = &id |
| 14277 | } |
| 14278 | } |
| 14279 | |
| 14280 | // withUser sets the old User of the mutation. |
| 14281 | func withUser(node *User) userOption { |
no test coverage detected