Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface { GetUsers(context.Context) (Users, error) GetUser(ctx context.Context, email string) (*ShowUser, error) GetPassword(ctx context.Context, email string) (*UserWithHashedPass, error) CreateUser(ctx context.Context, user User) (*ShowUser, error) UpdateUser(ctx context.Context, user UserWithHashedPass) (*ShowUser, error) DeleteUser(ctx context.Context, email string) (bool, error) HashPassword(password string) ([]byte, error) ValidatePassword(ctx context.Context, username, password string) (valid bool, err error) CreateUserWithHashedPass(ctx context.Context, user UserWithHashedPass) (*ShowUser, error) }
Adapter is the interface for various adapters
type AlreadyExistsError ¶
type AlreadyExistsError struct{}
AlreadyExistsError is returned when the user's email already exists in the database
func (*AlreadyExistsError) Error ¶
func (e *AlreadyExistsError) Error() string
type NotFoundError ¶
type NotFoundError struct{}
NotFoundError is the error returned when the user wasn't found, to discern this from other errors -- failures to reach the backend services, etc.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type ShowUser ¶
type ShowUser struct { ID string `json:"id" binding:"required"` Name string `json:"name" binding:"required"` Email string `json:"email" binding:"required"` }
ShowUser does not have the password field so we don't accidentally expose it
type User ¶
type User struct { ID string `json:"id"` Name string `json:"name" binding:"required"` Email string `json:"email" binding:"required"` Password string `json:"password" binding:"required"` }
User is the type of a struct of User data
type UserWithHashedPass ¶
Click to show internal directories.
Click to hide internal directories.