MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / defaults

Method defaults

ent/user_create.go:338–366  ·  view source on GitHub ↗

defaults sets the default values of the builder before save.

()

Source from the content-addressed store, hash-verified

336
337// defaults sets the default values of the builder before save.
338func (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.
369func (uc *UserCreate) check() error {

Callers 2

SaveMethod · 0.95
SaveMethod · 0.45

Calls 10

StorageMethod · 0.80
CreatedAtMethod · 0.65
UpdatedAtMethod · 0.65
StatusMethod · 0.65
SetStatusMethod · 0.65
SettingsMethod · 0.65
SetCreatedAtMethod · 0.45
SetUpdatedAtMethod · 0.45
SetStorageMethod · 0.45
SetSettingsMethod · 0.45

Tested by

no test coverage detected