withAPITokenID sets the ID field of the mutation.
(id uuid.UUID)
| 118 | |
| 119 | // withAPITokenID sets the ID field of the mutation. |
| 120 | func withAPITokenID(id uuid.UUID) apitokenOption { |
| 121 | return func(m *APITokenMutation) { |
| 122 | var ( |
| 123 | err error |
| 124 | once sync.Once |
| 125 | value *APIToken |
| 126 | ) |
| 127 | m.oldValue = func(ctx context.Context) (*APIToken, error) { |
| 128 | once.Do(func() { |
| 129 | if m.done { |
| 130 | err = errors.New("querying old values post mutation is not allowed") |
| 131 | } else { |
| 132 | value, err = m.Client().APIToken.Get(ctx, id) |
| 133 | } |
| 134 | }) |
| 135 | return value, err |
| 136 | } |
| 137 | m.id = &id |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // withAPIToken sets the old APIToken of the mutation. |
| 142 | func withAPIToken(node *APIToken) apitokenOption { |
no test coverage detected