MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / createSpec

Method createSpec

ent/user_create.go:430–633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

428}
429
430func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
431 var (
432 _node = &User{config: uc.config}
433 _spec = sqlgraph.NewCreateSpec(user.Table, sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt))
434 )
435
436 if id, ok := uc.mutation.ID(); ok {
437 _node.ID = id
438 id64 := int64(id)
439 _spec.ID.Value = id64
440 }
441
442 _spec.OnConflict = uc.conflict
443 if value, ok := uc.mutation.CreatedAt(); ok {
444 _spec.SetField(user.FieldCreatedAt, field.TypeTime, value)
445 _node.CreatedAt = value
446 }
447 if value, ok := uc.mutation.UpdatedAt(); ok {
448 _spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
449 _node.UpdatedAt = value
450 }
451 if value, ok := uc.mutation.DeletedAt(); ok {
452 _spec.SetField(user.FieldDeletedAt, field.TypeTime, value)
453 _node.DeletedAt = &value
454 }
455 if value, ok := uc.mutation.Email(); ok {
456 _spec.SetField(user.FieldEmail, field.TypeString, value)
457 _node.Email = value
458 }
459 if value, ok := uc.mutation.Nick(); ok {
460 _spec.SetField(user.FieldNick, field.TypeString, value)
461 _node.Nick = value
462 }
463 if value, ok := uc.mutation.Password(); ok {
464 _spec.SetField(user.FieldPassword, field.TypeString, value)
465 _node.Password = value
466 }
467 if value, ok := uc.mutation.Status(); ok {
468 _spec.SetField(user.FieldStatus, field.TypeEnum, value)
469 _node.Status = value
470 }
471 if value, ok := uc.mutation.Storage(); ok {
472 _spec.SetField(user.FieldStorage, field.TypeInt64, value)
473 _node.Storage = value
474 }
475 if value, ok := uc.mutation.TwoFactorSecret(); ok {
476 _spec.SetField(user.FieldTwoFactorSecret, field.TypeString, value)
477 _node.TwoFactorSecret = value
478 }
479 if value, ok := uc.mutation.Avatar(); ok {
480 _spec.SetField(user.FieldAvatar, field.TypeString, value)
481 _node.Avatar = value
482 }
483 if value, ok := uc.mutation.Settings(); ok {
484 _spec.SetField(user.FieldSettings, field.TypeJSON, value)
485 _node.Settings = value
486 }
487 if nodes := uc.mutation.GroupIDs(); len(nodes) > 0 {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 15

EmailMethod · 0.80
NickMethod · 0.80
StorageMethod · 0.80
TwoFactorSecretMethod · 0.80
GroupIDsMethod · 0.80
DavAccountsIDsMethod · 0.80
PasskeyIDsMethod · 0.80
TasksIDsMethod · 0.80
FseventsIDsMethod · 0.80
OauthGrantsIDsMethod · 0.80
IDMethod · 0.65
CreatedAtMethod · 0.65

Tested by

no test coverage detected