Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { //GetOne(ctx context.Context, id uint) (User, error) GetByUsername(ctx context.Context, username string) (User, error) Create(ctx context.Context, user *User) error Update(ctx context.Context, id uint, user User) error Delete(ctx context.Context, id uint) error }
Repository handle the CRUD operations with Users.
type User ¶
type User struct { ID uint `json:"id,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Location string `json:"location,omitempty"` GamesWon int `json:"games_won,omitempty"` GamesLost int `json:"games_lost,omitempty"` Password string `json:"password,omitempty"` PasswordHash string `json:"-"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
User of the system.
func (*User) HashPassword ¶
HashPassword generates a hash of the password and places the result in PasswordHash.
func (User) PasswordMatch ¶
PasswordMatch compares HashPassword with the password and returns true if they match.
Click to show internal directories.
Click to hide internal directories.