(ctx context.Context)
| 134 | } |
| 135 | |
| 136 | func (_u *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error) { |
| 137 | _spec := sqlgraph.NewUpdateSpec(lock.Table, lock.Columns, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) |
| 138 | id, ok := _u.mutation.ID() |
| 139 | if !ok { |
| 140 | return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Lock.id" for update`)} |
| 141 | } |
| 142 | _spec.Node.ID.Value = id |
| 143 | if fields := _u.fields; len(fields) > 0 { |
| 144 | _spec.Node.Columns = make([]string, 0, len(fields)) |
| 145 | _spec.Node.Columns = append(_spec.Node.Columns, lock.FieldID) |
| 146 | for _, f := range fields { |
| 147 | if !lock.ValidColumn(f) { |
| 148 | return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} |
| 149 | } |
| 150 | if f != lock.FieldID { |
| 151 | _spec.Node.Columns = append(_spec.Node.Columns, f) |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | if ps := _u.mutation.predicates; len(ps) > 0 { |
| 156 | _spec.Predicate = func(selector *sql.Selector) { |
| 157 | for i := range ps { |
| 158 | ps[i](selector) |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | _node = &Lock{config: _u.config} |
| 163 | _spec.Assign = _node.assignValues |
| 164 | _spec.ScanValues = _node.scanValues |
| 165 | if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { |
| 166 | if _, ok := err.(*sqlgraph.NotFoundError); ok { |
| 167 | err = &NotFoundError{lock.Label} |
| 168 | } else if sqlgraph.IsConstraintError(err) { |
| 169 | err = &ConstraintError{msg: err.Error(), wrap: err} |
| 170 | } |
| 171 | return nil, err |
| 172 | } |
| 173 | _u.mutation.done = true |
| 174 | return _node, nil |
| 175 | } |
nothing calls this directly
no test coverage detected