MCPcopy
hub / github.com/Wei-Shaw/sub2api / withAPIKeyID

Function withAPIKeyID

backend/ent/mutation.go:170–189  ·  view source on GitHub ↗

withAPIKeyID sets the ID field of the mutation.

(id int64)

Source from the content-addressed store, hash-verified

168
169// withAPIKeyID sets the ID field of the mutation.
170func 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.
192func withAPIKey(node *APIKey) apikeyOption {

Callers 1

UpdateOneIDMethod · 0.85

Calls 3

DoMethod · 0.65
GetMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected