usermgmt

package
v0.0.0-...-497d2ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(mx *mux.Router, db *sql.DB)

func NewPostgresConnection

func NewPostgresConnection() *sql.DB

Types

type InMemoryUserRepository

type InMemoryUserRepository struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*InMemoryUserRepository) AddUser

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 (*UserPostgresRepository) GetUserByUsername

func (r *UserPostgresRepository) GetUserByUsername(username string) (UserModel, error)

type UserRepository

type UserRepository interface {
	AddUser(UserCreateRequest) error
	GetUserByUsername(string) (UserModel, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL