Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrNotFound modelError = "model: resource not found" ErrIDInvalid modelError = "model: ID provided was invalid" ErrPasswordInccorect modelError = "model: incorrect password provided" ErrEmailRequired modelError = "model: email address is required" ErrEmailInvalid modelError = "model: email address is not valid" ErrEmailTaken modelError = "model: email address is already taken" ErrPasswordTooShort modelError = "model: password must be at least 8 characters long" ErrPasswordRequired modelError = "model: password is required" ErrRememberRequited modelError = "model: remember token is required" ErrRememberTooShort modelError = "model: remember token must be at least 32 bytes long" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { gorm.Model Name string Email string `gorm:"not null;unique_index"` Password string `gorm:"-"` PasswordHash string `gorm:"not null"` Remember string `gorm:"-"` RememberHash string `gorm:"not null;unique_index"` }
user db representation
type UserDB ¶
type UserDB interface { // db look ups with args ByID(id uint) (*User, error) ByEmail(email string) (*User, error) ByRemember(token string) (*User, error) // altering db data Create(user *User) error Update(user *User) error Delete(id uint) error // db operations Close() error AutoMigrate() error DestructiveReset() error }
type UserService ¶
func NewUserService ¶
func NewUserService(connInfo string) (UserService, error)
Click to show internal directories.
Click to hide internal directories.