Documentation ¶
Index ¶
- func ValidateAdminExists(db *gorm.DB, objectName string) validation.RuleFunc
- func ValidateEmailUniqueness(db *gorm.DB, toInsert bool, id int) validation.RuleFunc
- func ValidateUserExistence(db *gorm.DB, toInsert bool) validation.RuleFunc
- func ValidateUserProfileConstraint(db *gorm.DB, toInsert bool, profileId int) validation.RuleFunc
- type User
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAdminExists ¶
func ValidateEmailUniqueness ¶
func ValidateUserExistence ¶
func ValidateUserProfileConstraint ¶
One profile per user - Used when updating
Types ¶
type User ¶
type User struct { models.BaseModelSoftDelete Email string `db:"email" gorm:"unique_index;varchar(150);index:user_email_idx"` Role int `db:"role" gorm:"not null; default:1"` UserProfile *UserProfile }
type UserProfile ¶
type UserProfile struct { models.BaseModelSoftDelete UserID int `db:"user_id" gorm:"index:user_id_profile_idx"` FirstName *string `db:"first_name"` LastName *string `db:"last_name"` }
func LoadUserProfile ¶
func LoadUserProfile(userId int, db *gorm.DB) *UserProfile
func (*UserProfile) BeforeCreate ¶
func (toCreate *UserProfile) BeforeCreate(db *gorm.DB) (err error)
func (*UserProfile) BeforeUpdate ¶
func (toUpdate *UserProfile) BeforeUpdate(db *gorm.DB) (err error)
Click to show internal directories.
Click to hide internal directories.