MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / withAPITokenID

Function withAPITokenID

app/controlplane/pkg/data/ent/mutation.go:120–139  ·  view source on GitHub ↗

withAPITokenID sets the ID field of the mutation.

(id uuid.UUID)

Source from the content-addressed store, hash-verified

118
119// withAPITokenID sets the ID field of the mutation.
120func 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.
142func withAPIToken(node *APIToken) apitokenOption {

Callers 1

UpdateOneIDMethod · 0.85

Calls 3

DoMethod · 0.80
GetMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected