check runs all checks and user-defined validators on the builder.
()
| 296 | |
| 297 | // check runs all checks and user-defined validators on the builder. |
| 298 | func (_c *MachineCreate) check() error { |
| 299 | if _, ok := _c.mutation.CreatedAt(); !ok { |
| 300 | return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Machine.created_at"`)} |
| 301 | } |
| 302 | if _, ok := _c.mutation.UpdatedAt(); !ok { |
| 303 | return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Machine.updated_at"`)} |
| 304 | } |
| 305 | if _, ok := _c.mutation.MachineId(); !ok { |
| 306 | return &ValidationError{Name: "machineId", err: errors.New(`ent: missing required field "Machine.machineId"`)} |
| 307 | } |
| 308 | if _, ok := _c.mutation.Password(); !ok { |
| 309 | return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "Machine.password"`)} |
| 310 | } |
| 311 | if _, ok := _c.mutation.IpAddress(); !ok { |
| 312 | return &ValidationError{Name: "ipAddress", err: errors.New(`ent: missing required field "Machine.ipAddress"`)} |
| 313 | } |
| 314 | if v, ok := _c.mutation.Scenarios(); ok { |
| 315 | if err := machine.ScenariosValidator(v); err != nil { |
| 316 | return &ValidationError{Name: "scenarios", err: fmt.Errorf(`ent: validator failed for field "Machine.scenarios": %w`, err)} |
| 317 | } |
| 318 | } |
| 319 | if _, ok := _c.mutation.IsValidated(); !ok { |
| 320 | return &ValidationError{Name: "isValidated", err: errors.New(`ent: missing required field "Machine.isValidated"`)} |
| 321 | } |
| 322 | if _, ok := _c.mutation.AuthType(); !ok { |
| 323 | return &ValidationError{Name: "auth_type", err: errors.New(`ent: missing required field "Machine.auth_type"`)} |
| 324 | } |
| 325 | return nil |
| 326 | } |
| 327 | |
| 328 | func (_c *MachineCreate) sqlSave(ctx context.Context) (*Machine, error) { |
| 329 | if err := _c.check(); err != nil { |