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

Method sqlSave

entc/integration/migrate/entv2/zoo_update.go:66–85  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

64}
65
66func (_u *ZooUpdate) sqlSave(ctx context.Context) (_node int, err error) {
67 _spec := sqlgraph.NewUpdateSpec(zoo.Table, zoo.Columns, sqlgraph.NewFieldSpec(zoo.FieldID, field.TypeInt))
68 if ps := _u.mutation.predicates; len(ps) > 0 {
69 _spec.Predicate = func(selector *sql.Selector) {
70 for i := range ps {
71 ps[i](selector)
72 }
73 }
74 }
75 if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
76 if _, ok := err.(*sqlgraph.NotFoundError); ok {
77 err = &NotFoundError{zoo.Label}
78 } else if sqlgraph.IsConstraintError(err) {
79 err = &ConstraintError{msg: err.Error(), wrap: err}
80 }
81 return 0, err
82 }
83 _u.mutation.done = true
84 return _node, nil
85}
86
87// ZooUpdateOne is the builder for updating a single Zoo entity.
88type ZooUpdateOne struct {

Callers

nothing calls this directly

Calls 5

NewUpdateSpecFunction · 0.92
NewFieldSpecFunction · 0.92
UpdateNodesFunction · 0.92
IsConstraintErrorFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected