Documentation ¶
Index ¶
- func HashPassword(password string) (string, error)
- func VerifyPassword(password string, hash string) bool
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteUser(db *gorm.DB, uid int) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) FindUserByEmail(db *gorm.DB, email string) (*User, error)
- func (u *User) FindUserByID(db *gorm.DB, uid int) (*User, error)
- func (r *User) Marshal() ([]byte, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) ValidUser(db *gorm.DB, email string, password string) (bool, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
func VerifyPassword ¶
Types ¶
type User ¶
type User struct { ID uint32 `gorm:"primary_key;auto_increment" json:"id"` FullName string `gorm:"size:255;null;" json:"full_name"` Name string `gorm:"size:100;not null;" json:"name"` LastName string `gorm:"size:100;not null;" json:"last_name"` Nickname string `gorm:"size:50;null;unique" json:"nickname"` IdCard string `gorm:"size:30;not null;unique" json:"id_card"` Email string `gorm:"size:100;not null;unique" json:"email"` Password string `gorm:"size:250;not null;" json:"password"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func UnmarshalUser ¶
func (*User) BeforeSave ¶
func (*User) FindUserByEmail ¶
Click to show internal directories.
Click to hide internal directories.