MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / sqlSave

Method sqlSave

ent/user_create.go:412–428  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

410}
411
412func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) {
413 if err := uc.check(); err != nil {
414 return nil, err
415 }
416 _node, _spec := uc.createSpec()
417 if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil {
418 if sqlgraph.IsConstraintError(err) {
419 err = &ConstraintError{msg: err.Error(), wrap: err}
420 }
421 return nil, err
422 }
423 id := _spec.ID.Value.(int64)
424 _node.ID = int(id)
425 uc.mutation.id = &_node.ID
426 uc.mutation.done = true
427 return _node, nil
428}
429
430func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
431 var (

Callers

nothing calls this directly

Calls 3

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected