MCPcopy
hub / github.com/crowdsecurity/crowdsec / sqlSave

Method sqlSave

pkg/database/ent/meta_create.go:166–182  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

164}
165
166func (_c *MetaCreate) sqlSave(ctx context.Context) (*Meta, error) {
167 if err := _c.check(); err != nil {
168 return nil, err
169 }
170 _node, _spec := _c.createSpec()
171 if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
172 if sqlgraph.IsConstraintError(err) {
173 err = &ConstraintError{msg: err.Error(), wrap: err}
174 }
175 return nil, err
176 }
177 id := _spec.ID.Value.(int64)
178 _node.ID = int(id)
179 _c.mutation.id = &_node.ID
180 _c.mutation.done = true
181 return _node, nil
182}
183
184func (_c *MetaCreate) createSpec() (*Meta, *sqlgraph.CreateSpec) {
185 var (

Callers

nothing calls this directly

Calls 3

checkMethod · 0.95
createSpecMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected