check runs all checks and user-defined validators on the builder.
()
| 277 | |
| 278 | // check runs all checks and user-defined validators on the builder. |
| 279 | func (_c *DecisionCreate) check() error { |
| 280 | if _, ok := _c.mutation.CreatedAt(); !ok { |
| 281 | return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Decision.created_at"`)} |
| 282 | } |
| 283 | if _, ok := _c.mutation.UpdatedAt(); !ok { |
| 284 | return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Decision.updated_at"`)} |
| 285 | } |
| 286 | if _, ok := _c.mutation.Scenario(); !ok { |
| 287 | return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Decision.scenario"`)} |
| 288 | } |
| 289 | if _, ok := _c.mutation.GetType(); !ok { |
| 290 | return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Decision.type"`)} |
| 291 | } |
| 292 | if _, ok := _c.mutation.Scope(); !ok { |
| 293 | return &ValidationError{Name: "scope", err: errors.New(`ent: missing required field "Decision.scope"`)} |
| 294 | } |
| 295 | if _, ok := _c.mutation.Value(); !ok { |
| 296 | return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "Decision.value"`)} |
| 297 | } |
| 298 | if _, ok := _c.mutation.Origin(); !ok { |
| 299 | return &ValidationError{Name: "origin", err: errors.New(`ent: missing required field "Decision.origin"`)} |
| 300 | } |
| 301 | if _, ok := _c.mutation.Simulated(); !ok { |
| 302 | return &ValidationError{Name: "simulated", err: errors.New(`ent: missing required field "Decision.simulated"`)} |
| 303 | } |
| 304 | return nil |
| 305 | } |
| 306 | |
| 307 | func (_c *DecisionCreate) sqlSave(ctx context.Context) (*Decision, error) { |
| 308 | if err := _c.check(); err != nil { |