Documentation ¶
Index ¶
Constants ¶
View Source
const ( CreateUserTable = `` /* 166-byte string literal not displayed */ AddUser = "INSERT INTO users(name, password) VALUES ($1, $2) ON CONFLICT DO NOTHING RETURNING id" DeleteUser = "DELETE FROM users WHERE id = $1" GetUserByID = "SELECT * FROM users WHERE id = $1" GetUserByName = "SELECT * FROM users WHERE name = $1" )
Variables ¶
View Source
var ( ErrDBMissingURL = errors.New("users db url is missing") ErrExists = errors.New("the user with specified name already exists") ErrNotFound = errors.New("user not found") )
View Source
var ErrCredMissing = errors.New("the user is missing one or more required fields")
Functions ¶
This section is empty.
Types ¶
type BasicRepo ¶
type BasicRepo struct {
// contains filtered or unexported fields
}
func NewBasicRepo ¶
func NewBasicRepo() *BasicRepo
func (*BasicRepo) GetUserByID ¶
type DBRepo ¶
type DBRepo struct {
// contains filtered or unexported fields
}
func (*DBRepo) GetUserByID ¶
type IRepository ¶
type IRepository interface { AddUser(ctx context.Context, user User) (User, error) DeleteUser(ctx context.Context, uid string) error GetUserByID(ctx context.Context, uid string) (User, error) GetUserByName(ctx context.Context, name string) (User, error) }
func NewRepo ¶
func NewRepo(repoURL string) (IRepository, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
NewService returns an instance of the Service with the associated repository.
Click to show internal directories.
Click to hide internal directories.