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

Method sqlSave

app/controlplane/pkg/data/ent/user_create.go:217–238  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

215}
216
217func (_c *UserCreate) sqlSave(ctx context.Context) (*User, error) {
218 if err := _c.check(); err != nil {
219 return nil, err
220 }
221 _node, _spec := _c.createSpec()
222 if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
223 if sqlgraph.IsConstraintError(err) {
224 err = &ConstraintError{msg: err.Error(), wrap: err}
225 }
226 return nil, err
227 }
228 if _spec.ID.Value != nil {
229 if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
230 _node.ID = *id
231 } else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
232 return nil, err
233 }
234 }
235 _c.mutation.id = &_node.ID
236 _c.mutation.done = true
237 return _node, nil
238}
239
240func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
241 var (

Callers

nothing calls this directly

Calls 4

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected