Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUserNotFound is returned when the user does not // exists or was not found given the search parameters. ErrUserNotFound = errors.New("user not found") // ErrInvalidUser is returned when the user given is not valid ErrInvalidUser = errors.New("invalid user") )
Functions ¶
Types ¶
type User ¶
type User struct { ID int `db:"id" json:"id"` Name string `db:"name" json:"name"` Email string `db:"email" json:"email,omitempty"` IsAdmin bool `db:"is_admin" json:"is_admin"` CreatedAt time.Time `db:"created_at" json:"created_at"` Hash []byte `db:"hash" json:"-"` // contains filtered or unexported fields }
User is a user model
func GetUserByID ¶
GetUserByID will get a user from the database by id
func GetUserByName ¶
GetUserByName will query the database for a user with a specific name
func (*User) PasswordOK ¶
PasswordOK check a password string against the stored password hash and returns false if the password is incorrect.
Click to show internal directories.
Click to hide internal directories.