defaults sets the default values of the builder before save.
()
| 336 | |
| 337 | // defaults sets the default values of the builder before save. |
| 338 | func (uc *UserCreate) defaults() error { |
| 339 | if _, ok := uc.mutation.CreatedAt(); !ok { |
| 340 | if user.DefaultCreatedAt == nil { |
| 341 | return fmt.Errorf("ent: uninitialized user.DefaultCreatedAt (forgotten import ent/runtime?)") |
| 342 | } |
| 343 | v := user.DefaultCreatedAt() |
| 344 | uc.mutation.SetCreatedAt(v) |
| 345 | } |
| 346 | if _, ok := uc.mutation.UpdatedAt(); !ok { |
| 347 | if user.DefaultUpdatedAt == nil { |
| 348 | return fmt.Errorf("ent: uninitialized user.DefaultUpdatedAt (forgotten import ent/runtime?)") |
| 349 | } |
| 350 | v := user.DefaultUpdatedAt() |
| 351 | uc.mutation.SetUpdatedAt(v) |
| 352 | } |
| 353 | if _, ok := uc.mutation.Status(); !ok { |
| 354 | v := user.DefaultStatus |
| 355 | uc.mutation.SetStatus(v) |
| 356 | } |
| 357 | if _, ok := uc.mutation.Storage(); !ok { |
| 358 | v := user.DefaultStorage |
| 359 | uc.mutation.SetStorage(v) |
| 360 | } |
| 361 | if _, ok := uc.mutation.Settings(); !ok { |
| 362 | v := user.DefaultSettings |
| 363 | uc.mutation.SetSettings(v) |
| 364 | } |
| 365 | return nil |
| 366 | } |
| 367 | |
| 368 | // check runs all checks and user-defined validators on the builder. |
| 369 | func (uc *UserCreate) check() error { |
no test coverage detected