postgres

package
v0.0.0-...-3a645ea Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPool

func NewPool(ctx context.Context, cfg Config) (*pgxpool.Pool, error)

func Tx

func Tx(
	ctx context.Context,
	pool *pgxpool.Pool,
	level pgx.TxIsoLevel,
	fns ...func(tx pgx.Tx) error,
) (err error)

Types

type Config

type Config struct {
	Log      logger.Logger
	User     string
	Password string
	Host     string
	Port     string
	Database string
	SSLMode  string
}

func NewConfig

func NewConfig(opts ...ConfigOption) Config

func NewConfigFromEnv

func NewConfigFromEnv() Config

func (Config) DSN

func (c Config) DSN() string

func (Config) Validate

func (c Config) Validate() error

type ConfigOption

type ConfigOption func(*Config)

func WithDatabase

func WithDatabase(database string) ConfigOption

func WithHost

func WithHost(host string) ConfigOption

func WithPassword

func WithPassword(password string) ConfigOption

func WithPort

func WithPort(port string) ConfigOption

func WithSSLMode

func WithSSLMode(sslMode string) ConfigOption

func WithUser

func WithUser(user string) ConfigOption

Jump to

Keyboard shortcuts

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