database

package
v0.0.0-...-7ad5d0e Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Queries

func Queries(ctx context.Context) (*db.Queries, error)

func WithLazyTx

func WithLazyTx(ctx context.Context, tx *LazyTx) context.Context

WithLazyTx stores the LazyTx in the context

func WithQueries

func WithQueries(ctx context.Context, q *db.Queries) context.Context

Types

type LazyTx

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

func GetLazyTx

func GetLazyTx(ctx context.Context) (*LazyTx, bool)

GetLazyTx retrieves the LazyTx from the context

func NewLazyTx

func NewLazyTx(ctx context.Context, pool *Pool, log *logger.Logger) *LazyTx

func (*LazyTx) Commit

func (lt *LazyTx) Commit(ctx context.Context) error

func (*LazyTx) Exec

func (lt *LazyTx) Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)

func (*LazyTx) IsStarted

func (lt *LazyTx) IsStarted() bool

func (*LazyTx) OnCommit

func (lt *LazyTx) OnCommit(hook func())

OnCommit registers a function to be called after the transaction successfully commits

func (*LazyTx) Query

func (lt *LazyTx) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)

func (*LazyTx) QueryRow

func (lt *LazyTx) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row

func (*LazyTx) Rollback

func (lt *LazyTx) Rollback(ctx context.Context) error

type Pool

type Pool struct {
	*pgxpool.Pool
	// contains filtered or unexported fields
}

func New

func New(cfg config.DatabaseConfig, m *metrics.Metrics) (*Pool, error)

func (*Pool) CheckHealth

func (p *Pool) CheckHealth(ctx context.Context) error

Jump to

Keyboard shortcuts

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