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

Method sqlSave

ent/entity_create.go:276–292  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

274}
275
276func (ec *EntityCreate) sqlSave(ctx context.Context) (*Entity, error) {
277 if err := ec.check(); err != nil {
278 return nil, err
279 }
280 _node, _spec := ec.createSpec()
281 if err := sqlgraph.CreateNode(ctx, ec.driver, _spec); err != nil {
282 if sqlgraph.IsConstraintError(err) {
283 err = &ConstraintError{msg: err.Error(), wrap: err}
284 }
285 return nil, err
286 }
287 id := _spec.ID.Value.(int64)
288 _node.ID = int(id)
289 ec.mutation.id = &_node.ID
290 ec.mutation.done = true
291 return _node, nil
292}
293
294func (ec *EntityCreate) createSpec() (*Entity, *sqlgraph.CreateSpec) {
295 var (

Callers

nothing calls this directly

Calls 3

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected