check runs all checks and user-defined validators on the builder.
()
| 263 | |
| 264 | // check runs all checks and user-defined validators on the builder. |
| 265 | func (nu *NodeUpdate) check() error { |
| 266 | if v, ok := nu.mutation.Status(); ok { |
| 267 | if err := node.StatusValidator(v); err != nil { |
| 268 | return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)} |
| 269 | } |
| 270 | } |
| 271 | if v, ok := nu.mutation.GetType(); ok { |
| 272 | if err := node.TypeValidator(v); err != nil { |
| 273 | return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Node.type": %w`, err)} |
| 274 | } |
| 275 | } |
| 276 | return nil |
| 277 | } |
| 278 | |
| 279 | func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { |
| 280 | if err := nu.check(); err != nil { |
no test coverage detected