postgres

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	io.Closer
	driver.Pinger

	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)

	Begin(ctx context.Context, f func(tx pgx.Tx) error) error
}

func New

func New(ctx context.Context, dsn string, opts ...Options) (DB, error)

type Options

type Options func(*pgxpool.Config)

func WithMaxConnIdleTime

func WithMaxConnIdleTime(t time.Duration) Options

func WithMaxConnLifetime

func WithMaxConnLifetime(t time.Duration) Options

func WithMaxConns

func WithMaxConns(n int32) Options

func WithMinConns

func WithMinConns(n int32) Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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