pgxreconnect

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

README

pgx-reconnect

Wrapper for https://github.com/jackc/pgx with support for reconnecting when a recoverable TCP error occurs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnString = errors.New("no connection string provided")
	ErrReconnect    = errors.New("error while reconnecting")
)

Functions

This section is empty.

Types

type ReConn

type ReConn struct {
	ConnString string
	Conn       *pgx.Conn
	Backoff    backoff.BackOff
}

func Connect

func Connect(ctx context.Context, connString string, bo backoff.BackOff) (*ReConn, error)

func (*ReConn) Close

func (c *ReConn) Close(ctx context.Context) error

func (*ReConn) Exec

func (c *ReConn) Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)

func (*ReConn) IsClosed

func (c *ReConn) IsClosed() bool

func (*ReConn) Ping

func (c *ReConn) Ping(ctx context.Context) error

func (*ReConn) Query

func (c *ReConn) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)

func (*ReConn) QueryRow

func (c *ReConn) QueryRow(ctx context.Context, sql string, args ...any) (pgx.Row, error)

func (*ReConn) Reconnect

func (c *ReConn) Reconnect(ctx context.Context) error

Jump to

Keyboard shortcuts

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