Documentation ¶
Index ¶
- func CheckPasswordHash(password, hash string) error
- func HashPassword(password string) (string, error)
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteByID(id int64) (*User, error)
- func (u *User) GetAllUsers() (*[]User, error)
- func (u *User) GetUserByEmail() (*User, error)
- func (u *User) GetUserByID(id int64) (*User, error)
- func (u *User) Prepare()
- func (u *User) SaveUser() (*User, error)
- func (u *User) UpdateByID(id int64, user User) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
CheckPasswordHash checks password hash and password from user input
func HashPassword ¶
HashPassword hashes password from user input
Types ¶
type User ¶
type User struct { gorm.Model Email string `gorm:"type:varchar(100);unique_index" json:"email"` UserName string `gorm:"size:100;not null" json:"username"` Password string `gorm:"size:100;not null" json:"password"` Avatar string `gorm:"size:255" json:"avatar"` Status int64 `json:"status"` }
User define model
func (*User) DeleteByID ¶
DeleteByID returns a user status false based on id
func (*User) GetAllUsers ¶
GetAllUsers returns a list of all the user
func (*User) GetUserByEmail ¶
GetUserByEmail returns a user based on email
func (*User) GetUserByID ¶
GetUserByID returns a user based on id
func (*User) UpdateByID ¶
UpdateByID return updated user
Click to show internal directories.
Click to hide internal directories.