MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / sqlSave

Method sqlSave

ent/node_create.go:390–411  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

388}
389
390func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) {
391 if err := nc.check(); err != nil {
392 return nil, err
393 }
394 _node, _spec := nc.createSpec()
395 if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
396 if sqlgraph.IsConstraintError(err) {
397 err = &ConstraintError{msg: err.Error(), wrap: err}
398 }
399 return nil, err
400 }
401 if _spec.ID.Value != nil {
402 if id, ok := _spec.ID.Value.(string); ok {
403 _node.ID = id
404 } else {
405 return nil, fmt.Errorf("unexpected Node.ID type: %T", _spec.ID.Value)
406 }
407 }
408 nc.mutation.id = &_node.ID
409 nc.mutation.done = true
410 return _node, nil
411}
412
413func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
414 var (

Callers

nothing calls this directly

Calls 4

checkMethod · 0.95
createSpecMethod · 0.95
CreateNodeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected