defaults sets the default values of the builder before save.
()
| 467 | |
| 468 | // defaults sets the default values of the builder before save. |
| 469 | func (_c *AlertCreate) defaults() { |
| 470 | if _, ok := _c.mutation.CreatedAt(); !ok { |
| 471 | v := alert.DefaultCreatedAt() |
| 472 | _c.mutation.SetCreatedAt(v) |
| 473 | } |
| 474 | if _, ok := _c.mutation.UpdatedAt(); !ok { |
| 475 | v := alert.DefaultUpdatedAt() |
| 476 | _c.mutation.SetUpdatedAt(v) |
| 477 | } |
| 478 | if _, ok := _c.mutation.BucketId(); !ok { |
| 479 | v := alert.DefaultBucketId |
| 480 | _c.mutation.SetBucketId(v) |
| 481 | } |
| 482 | if _, ok := _c.mutation.Message(); !ok { |
| 483 | v := alert.DefaultMessage |
| 484 | _c.mutation.SetMessage(v) |
| 485 | } |
| 486 | if _, ok := _c.mutation.EventsCount(); !ok { |
| 487 | v := alert.DefaultEventsCount |
| 488 | _c.mutation.SetEventsCount(v) |
| 489 | } |
| 490 | if _, ok := _c.mutation.StartedAt(); !ok { |
| 491 | v := alert.DefaultStartedAt() |
| 492 | _c.mutation.SetStartedAt(v) |
| 493 | } |
| 494 | if _, ok := _c.mutation.StoppedAt(); !ok { |
| 495 | v := alert.DefaultStoppedAt() |
| 496 | _c.mutation.SetStoppedAt(v) |
| 497 | } |
| 498 | if _, ok := _c.mutation.Simulated(); !ok { |
| 499 | v := alert.DefaultSimulated |
| 500 | _c.mutation.SetSimulated(v) |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | // check runs all checks and user-defined validators on the builder. |
| 505 | func (_c *AlertCreate) check() error { |
no test coverage detected