withAPIKeyID sets the ID field of the mutation.
(id int64)
| 168 | |
| 169 | // withAPIKeyID sets the ID field of the mutation. |
| 170 | func withAPIKeyID(id int64) apikeyOption { |
| 171 | return func(m *APIKeyMutation) { |
| 172 | var ( |
| 173 | err error |
| 174 | once sync.Once |
| 175 | value *APIKey |
| 176 | ) |
| 177 | m.oldValue = func(ctx context.Context) (*APIKey, error) { |
| 178 | once.Do(func() { |
| 179 | if m.done { |
| 180 | err = errors.New("querying old values post mutation is not allowed") |
| 181 | } else { |
| 182 | value, err = m.Client().APIKey.Get(ctx, id) |
| 183 | } |
| 184 | }) |
| 185 | return value, err |
| 186 | } |
| 187 | m.id = &id |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | // withAPIKey sets the old APIKey of the mutation. |
| 192 | func withAPIKey(node *APIKey) apikeyOption { |
no test coverage detected