pgsqlx

package
v0.0.0-...-b1e8203 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host            string        `mapstructure:"host"`
	Port            int           `mapstructure:"port"`
	User            string        `mapstructure:"user"`
	Password        string        `mapstructure:"password"`
	DBName          string        `mapstructure:"dbname"`
	SSLMode         string        `mapstructure:"ssl_mode"`
	ConnectTimeout  time.Duration `mapstructure:"connect_timeout"`
	ApplicationName string        `mapstructure:"application_name"`

	MaxOpenConns    int           `mapstructure:"max_open_conns"`
	MaxIdleConns    int           `mapstructure:"max_idle_conns"`
	ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime"`
	ConnMaxIdleTime time.Duration `mapstructure:"conn_max_idle_time"`
}

type PGx

type PGx struct {
	*sqlx.DB
}

func NewPostgres

func NewPostgres(conf *Config) (*PGx, error)

func (*PGx) Tx

func (p *PGx) Tx(ctx context.Context, fn TxFunc) error

func (*PGx) TxOptions

func (p *PGx) TxOptions(ctx context.Context, opts *TxOptions, fn TxFunc) error

type TxFunc

type TxFunc func(*sqlx.Tx) error

type TxOptions

type TxOptions struct {
	Isolation sql.IsolationLevel
	ReadOnly  bool
}

Jump to

Keyboard shortcuts

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