pgbase

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FullTextSearchReplacer = strings.NewReplacer("/", " ", ".", " ")
)

Functions

func CreateAndMigrateTestDatabase

func CreateAndMigrateTestDatabase(t *testing.T, ctx context.Context) *pgxpool.Pool

func GenerateFakeUser

func GenerateFakeUser(t *testing.T, fake *faker.Faker) user.User

Types

type Repository

type Repository struct {
	Pool *pgxpool.Pool
}

Repository provides a PostgreSQL persistence layer.

func NewRepository

func NewRepository(pool *pgxpool.Pool) *Repository

NewRepository initializes and returns a PostgreSQL Repository.

func (*Repository) QueryTx

func (r *Repository) QueryTx(domain string, operation string, query string, args pgx.NamedArgs) error

func (*Repository) Rollback

func (r *Repository) Rollback(ctx context.Context, tx pgx.Tx, domain string, operation string)

func (*Repository) RowExistsByQuery

func (r *Repository) RowExistsByQuery(query string, queryParams ...any) (bool, error)

Jump to

Keyboard shortcuts

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