pgdb

package
v0.0.0-...-e34d481 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

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

func NewPostgres

func NewPostgres(ctx context.Context, url string, minConns, maxConns int32) (*Postgres, error)

func (*Postgres) Close

func (p *Postgres) Close()

func (*Postgres) Queries

func (p *Postgres) Queries(ctx context.Context, fn func(ctx context.Context, q *dbgen.Queries) error) error

Queries runs fn against a connection-scoped *dbgen.Queries.

func (*Postgres) QueriesWithTx

func (p *Postgres) QueriesWithTx(ctx context.Context, fn func(ctx context.Context, q *dbgen.Queries) error) error

QueriesWithTx runs fn inside a transaction. The transaction is committed if fn returns nil, rolled back otherwise.

Directories

Path Synopsis
Package pgdbtest boots a throwaway Postgres via testcontainers-go and returns a connected *pgdb.Postgres with migrations already applied.
Package pgdbtest boots a throwaway Postgres via testcontainers-go and returns a connected *pgdb.Postgres with migrations already applied.

Jump to

Keyboard shortcuts

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