retrier

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package retrier provides a wrapper around pgxpool.Pool that retries the queries

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	DBPool  *pgxpool.Pool
	Retrier retry.Retry
}

Pool is a pgxpoooooool that has a retrier.

func (*Pool) BeginTransaction

func (r *Pool) BeginTransaction(ctx context.Context) (pgx.Tx, error)

BeginTransaction returns a transaction and an error. It'll retry till it works.

func (*Pool) Close

func (r *Pool) Close()

Close terminates the pool.

func (*Pool) CopyFrom

func (r *Pool) CopyFrom(
	ctx context.Context,
	tableName pgx.Identifier,
	columnNames []string,
	rowSrc pgx.CopyFromSource,
) (int64, error)

CopyFrom executes a copy from. It is not recommended to retry a copy from.

func (*Pool) Exec

func (r *Pool) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

Exec executes a query.

func (*Pool) Query

func (r *Pool) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

Query executes a query and returns the rows.

func (*Pool) QueryRowScan

func (r *Pool) QueryRowScan(ctx context.Context, sql string, queryParams, scanParams []interface{}) error

QueryRowScan is a wrapper on top of QueryRow that also integrates the Scan bit.

Jump to

Keyboard shortcuts

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