db

package
v0.0.0-...-4abda61 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDbWithWait

func NewDbWithWait(connectionString string, dbOptions DBOptions) (*pgxpool.Pool, error)

func PerformMigrations

func PerformMigrations(fs embed.FS, dbPrefix string, connectionStr string)

PerformMigrations will automatically connect to the database and perform any unapplied migrations from the passed in file system. This method should be safe to run concurrently as it will acquire a database level lock before applying migrations

Types

type DBOptions

type DBOptions struct {
	TimeoutSec      int
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime int // maximum connection lifetime in seconds
	ConnMaxIdleTime int // maximum connection idle time in seconds
	EnableTracing   bool
}

type DbOrTx

type DbOrTx interface {
	Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}

Jump to

Keyboard shortcuts

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