database

package
v0.0.0-...-10cef3e Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Conn *sqlx.DB
}

func DefaultDatabase

func DefaultDatabase(config *config.Config) (*DB, error)

DefaultDatabase returns an instance of a psql database

func NewPSQL

func NewPSQL(dsn string) (*DB, error)

func (*DB) UserService

func (db *DB) UserService(conn *sqlx.DB) services.UserService

type ProblemService

type ProblemService struct {
	// contains filtered or unexported fields
}

ProblemService implements services.ProblemService

func (*ProblemService) Create

func (s *ProblemService) Create(ctx context.Context, problem *models.Problem) (*models.Problem, error)

func (*ProblemService) GetAll

func (s *ProblemService) GetAll(ctx context.Context) ([]*models.Problem, error)

func (*ProblemService) GetById

func (s *ProblemService) GetById(ctx context.Context, id int) (*models.Problem, error)

func (*ProblemService) GetByName

func (s *ProblemService) GetByName(ctx context.Context, name string) (*models.Problem, error)

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService implements services.UserService

func NewUserService

func NewUserService(db *sqlx.DB) *UserService

func (*UserService) Create

func (s *UserService) Create(ctx context.Context, username, email, password string) error

func (*UserService) ExistsByEmail

func (s *UserService) ExistsByEmail(ctx context.Context, email string) (bool, error)

func (*UserService) ExistsByUsername

func (s *UserService) ExistsByUsername(ctx context.Context, username string) (bool, error)

func (*UserService) GetAll

func (s *UserService) GetAll(ctx context.Context) ([]*models.User, error)

func (*UserService) GetByEmail

func (s *UserService) GetByEmail(ctx context.Context, email string) (*models.User, error)

func (*UserService) GetById

func (s *UserService) GetById(ctx context.Context, id int) (*models.User, error)

func (*UserService) GetByUsername

func (s *UserService) GetByUsername(ctx context.Context, username string) (*models.User, error)

Jump to

Keyboard shortcuts

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