MCPcopy
hub / github.com/ent/ent / sqlExec

Method sqlExec

entc/integration/migrate/entv2/blog_delete.go:46–61  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

44}
45
46func (_d *BlogDelete) sqlExec(ctx context.Context) (int, error) {
47 _spec := sqlgraph.NewDeleteSpec(blog.Table, sqlgraph.NewFieldSpec(blog.FieldID, field.TypeInt))
48 if ps := _d.mutation.predicates; len(ps) > 0 {
49 _spec.Predicate = func(selector *sql.Selector) {
50 for i := range ps {
51 ps[i](selector)
52 }
53 }
54 }
55 affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
56 if err != nil && sqlgraph.IsConstraintError(err) {
57 err = &ConstraintError{msg: err.Error(), wrap: err}
58 }
59 _d.mutation.done = true
60 return affected, err
61}
62
63// BlogDeleteOne is the builder for deleting a single Blog entity.
64type BlogDeleteOne struct {

Callers

nothing calls this directly

Calls 5

NewDeleteSpecFunction · 0.92
NewFieldSpecFunction · 0.92
DeleteNodesFunction · 0.92
IsConstraintErrorFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected