Documentation
¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid uint32) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) ([]UserReturn, error)
- func (u *User) FindUserByID(db *gorm.DB, uid uint32) (UserReturn, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid uint32) (*User, error)
- func (u *User) Validate(action string) error
- type UserReturn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
VerifyPassword func to check if passwords match
Types ¶
type User ¶
type User struct {
ID uint32 `gorm:"primary_key;auto_increment" json:"id"`
Nickname string `gorm:"size:255;not null;unique" json:"nickname"`
Email string `gorm:"size:100;not null;unique" json:"email"`
Password string `gorm:"size:100;not null;" json:"password"`
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}
User model definition
func (*User) BeforeSave ¶
BeforeSave func to generate user pass hash and set it
func (*User) DeleteAUser ¶
DeleteAUser func to delete a given user by id
func (*User) FindAllUsers ¶
func (u *User) FindAllUsers(db *gorm.DB) ([]UserReturn, error)
FindAllUsers func to query all the users in the db
func (*User) FindUserByID ¶
FindUserByID func to get a particular by ID
func (*User) UpdateAUser ¶
UpdateAUser func to update a given user by id
type UserReturn ¶
UserReturn return struct
Click to show internal directories.
Click to hide internal directories.