database

package
v0.0.0-...-c9e0f0f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, dsn string, log logrus.FieldLogger, opts ...OptFunc) (*pgxpool.Pool, error)

func NewLoaderContext

func NewLoaderContext(ctx context.Context, dbConn *pgxpool.Pool) context.Context

func NewPool

func NewPool(ctx context.Context, dsn string, log logrus.FieldLogger, migrate bool, opts ...OptFunc) (*pgxpool.Pool, error)

func Transaction

func Transaction(ctx context.Context, callback func(ctx context.Context) error) error

Transaction executes a callback function within a transaction. Multiple calls to Transaction will start "nested" transactions (https://www.postgresql.org/docs/current/sql-savepoint.html).

func TransactionFromContext

func TransactionFromContext(ctx context.Context) pgx.Tx

TransactionFromContext will return a potentially open transaction from the context, nil if none exists.

Types

type OptFunc

type OptFunc func(*settings)

func WithSlowQueryLogger

func WithSlowQueryLogger(d time.Duration) OptFunc

WithSlowQueryLogger enables slow query logging This exposes attributes of the slow query to the logger, so it should not be used in production

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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