check runs all checks and user-defined validators on the builder.
()
| 278 | |
| 279 | // check runs all checks and user-defined validators on the builder. |
| 280 | func (nvc *NodeVersionCreate) check() error { |
| 281 | if _, ok := nvc.mutation.CreateTime(); !ok { |
| 282 | return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "NodeVersion.create_time"`)} |
| 283 | } |
| 284 | if _, ok := nvc.mutation.UpdateTime(); !ok { |
| 285 | return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "NodeVersion.update_time"`)} |
| 286 | } |
| 287 | if _, ok := nvc.mutation.NodeID(); !ok { |
| 288 | return &ValidationError{Name: "node_id", err: errors.New(`ent: missing required field "NodeVersion.node_id"`)} |
| 289 | } |
| 290 | if _, ok := nvc.mutation.Version(); !ok { |
| 291 | return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "NodeVersion.version"`)} |
| 292 | } |
| 293 | if _, ok := nvc.mutation.PipDependencies(); !ok { |
| 294 | return &ValidationError{Name: "pip_dependencies", err: errors.New(`ent: missing required field "NodeVersion.pip_dependencies"`)} |
| 295 | } |
| 296 | if _, ok := nvc.mutation.Deprecated(); !ok { |
| 297 | return &ValidationError{Name: "deprecated", err: errors.New(`ent: missing required field "NodeVersion.deprecated"`)} |
| 298 | } |
| 299 | if _, ok := nvc.mutation.Status(); !ok { |
| 300 | return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "NodeVersion.status"`)} |
| 301 | } |
| 302 | if v, ok := nvc.mutation.Status(); ok { |
| 303 | if err := nodeversion.StatusValidator(v); err != nil { |
| 304 | return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "NodeVersion.status": %w`, err)} |
| 305 | } |
| 306 | } |
| 307 | if _, ok := nvc.mutation.StatusReason(); !ok { |
| 308 | return &ValidationError{Name: "status_reason", err: errors.New(`ent: missing required field "NodeVersion.status_reason"`)} |
| 309 | } |
| 310 | if _, ok := nvc.mutation.ComfyNodeExtractStatus(); !ok { |
| 311 | return &ValidationError{Name: "comfy_node_extract_status", err: errors.New(`ent: missing required field "NodeVersion.comfy_node_extract_status"`)} |
| 312 | } |
| 313 | if len(nvc.mutation.NodeIDs()) == 0 { |
| 314 | return &ValidationError{Name: "node", err: errors.New(`ent: missing required edge "NodeVersion.node"`)} |
| 315 | } |
| 316 | return nil |
| 317 | } |
| 318 | |
| 319 | func (nvc *NodeVersionCreate) sqlSave(ctx context.Context) (*NodeVersion, error) { |
| 320 | if err := nvc.check(); err != nil { |
no test coverage detected