db

package
v0.0.0-...-28d87ae Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAlreadyExistsErrorKeyValue

func GetAlreadyExistsErrorKeyValue(err *pq.Error) (string, string)

func MigrateUp

func MigrateUp(t *testing.T, db *sql.DB) error

func NewDefaultPostgresConfig

func NewDefaultPostgresConfig(dbName string) pgTools.Config

NewDefaultPostgresConfig creates and return a default postgres configuration.

func SetUpDB

func SetUpDB(t *testing.T, dbName string, superUserPGConfig pgTools.Config) (*sql.DB, error)

func SetUpUserRepo

func SetUpUserRepo(t *testing.T, sqlxDB *sqlx.DB) (domain.UserRepo, []*domain.User)

Types

type PGLoginRepo

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

func NewPGLoginRepo

func NewPGLoginRepo(db *sqlx.DB, userRepo domain.UserRepo) *PGLoginRepo

func (*PGLoginRepo) Create

func (r *PGLoginRepo) Create(login *domain.Login) (*domain.Login, error)

func (*PGLoginRepo) GetByID

func (r *PGLoginRepo) GetByID(id uuid.UUID) (*domain.Login, error)

type PGUserRepo

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

func NewPGUserRepo

func NewPGUserRepo(db *sqlx.DB, hasher domain.Hasher) *PGUserRepo

func (*PGUserRepo) Create

func (r *PGUserRepo) Create(user *domain.User, password *domain.Password) (*domain.User, error)

func (*PGUserRepo) GetByID

func (r *PGUserRepo) GetByID(id uuid.UUID) (*domain.User, error)

func (*PGUserRepo) GetByUsername

func (r *PGUserRepo) GetByUsername(username string) (*domain.User, error)

func (*PGUserRepo) VerifyPassword

func (r *PGUserRepo) VerifyPassword(username string, password string) (bool, error)

Jump to

Keyboard shortcuts

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