MCPcopy
hub / github.com/cloudreve/cloudreve / sqlSave

Method sqlSave

ent/file_create.go:363–379  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

361}
362
363func (fc *FileCreate) sqlSave(ctx context.Context) (*File, error) {
364 if err := fc.check(); err != nil {
365 return nil, err
366 }
367 _node, _spec := fc.createSpec()
368 if err := sqlgraph.CreateNode(ctx, fc.driver, _spec); err != nil {
369 if sqlgraph.IsConstraintError(err) {
370 err = &ConstraintError{msg: err.Error(), wrap: err}
371 }
372 return nil, err
373 }
374 id := _spec.ID.Value.(int64)
375 _node.ID = int(id)
376 fc.mutation.id = &_node.ID
377 fc.mutation.done = true
378 return _node, nil
379}
380
381func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) {
382 var (

Callers

nothing calls this directly

Calls 3

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected