Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPostgresConnection ¶
Types ¶
type InMemoryUserRepository ¶
func (*InMemoryUserRepository) AddUser ¶
func (r *InMemoryUserRepository) AddUser(u *UserCreateRequest) error
func (*InMemoryUserRepository) GetUserByUsername ¶
func (r *InMemoryUserRepository) GetUserByUsername(username string) (UserModel, error)
type UserAlreadyExistsError ¶
type UserAlreadyExistsError struct{}
func (*UserAlreadyExistsError) Error ¶
func (e *UserAlreadyExistsError) Error() string
type UserCreateRequest ¶
type UserCreateRequest struct { Username string `json:"username"` Password string `json:"password"` }
func (*UserCreateRequest) IsValid ¶
func (u *UserCreateRequest) IsValid() bool
type UserModel ¶
type UserModel struct { ID int `json:"id"` Username string `json:"username"` Password string `json:"password"` }
func NewUserFromRequest ¶
func NewUserFromRequest(req *UserCreateRequest) *UserModel
type UserNotFoundError ¶
type UserNotFoundError struct{}
func (*UserNotFoundError) Error ¶
func (e *UserNotFoundError) Error() string
type UserPostgresRepository ¶
type UserPostgresRepository struct {
// contains filtered or unexported fields
}
func NewUserPostgresRepository ¶
func NewUserPostgresRepository(db *sql.DB) *UserPostgresRepository
func (*UserPostgresRepository) AddUser ¶
func (r *UserPostgresRepository) AddUser(req UserCreateRequest) error
func (*UserPostgresRepository) GetUserByUsername ¶
func (r *UserPostgresRepository) GetUserByUsername(username string) (UserModel, error)
type UserRepository ¶
type UserRepository interface { AddUser(UserCreateRequest) error GetUserByUsername(string) (UserModel, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.