MCPcopy
hub / github.com/ent/ent / sqlSave

Method sqlSave

entc/integration/migrate/entv2/conversion_create.go:188–204  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

186}
187
188func (_c *ConversionCreate) sqlSave(ctx context.Context) (*Conversion, error) {
189 if err := _c.check(); err != nil {
190 return nil, err
191 }
192 _node, _spec := _c.createSpec()
193 if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
194 if sqlgraph.IsConstraintError(err) {
195 err = &ConstraintError{msg: err.Error(), wrap: err}
196 }
197 return nil, err
198 }
199 id := _spec.ID.Value.(int64)
200 _node.ID = int(id)
201 _c.mutation.id = &_node.ID
202 _c.mutation.done = true
203 return _node, nil
204}
205
206func (_c *ConversionCreate) createSpec() (*Conversion, *sqlgraph.CreateSpec) {
207 var (

Callers

nothing calls this directly

Calls 5

checkMethod · 0.95
createSpecMethod · 0.95
CreateNodeFunction · 0.92
IsConstraintErrorFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected