MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / sqlSave

Method sqlSave

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

Source from the content-addressed store, hash-verified

253}
254
255func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) {
256 if err := nc.check(); err != nil {
257 return nil, err
258 }
259 _node, _spec := nc.createSpec()
260 if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
261 if sqlgraph.IsConstraintError(err) {
262 err = &ConstraintError{msg: err.Error(), wrap: err}
263 }
264 return nil, err
265 }
266 id := _spec.ID.Value.(int64)
267 _node.ID = int(id)
268 nc.mutation.id = &_node.ID
269 nc.mutation.done = true
270 return _node, nil
271}
272
273func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
274 var (

Callers

nothing calls this directly

Calls 3

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected