retrytx

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: MIT Imports: 5 Imported by: 0

README

retrytx

Build Status GitHub release Go Report Card GoDoc

Retry database transactions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryTx

func RetryTx(
	ctx context.Context,
	db *sql.DB,
	worker func(context.Context, *sql.Tx) error,
	opts ...Option,
) (err error)

RetryTx retries worker while it returns error. Each retry starts with new transaction.

func RetryTxx

func RetryTxx(
	ctx context.Context,
	db *sqlx.DB,
	worker func(context.Context, *sqlx.Tx) error,
	opts ...Option,
) (err error)

RetryTxx retries worker while it returns error. Each retry starts with new transaction.

Types

type Option

type Option func(*Options)

func WithConstantBackOff

func WithConstantBackOff(interval time.Duration) Option

func WithMaxRetries

func WithMaxRetries(retries uint64) Option

type Options

type Options struct {
	WithConstantBackOff     bool
	ConstantBackOffInterval time.Duration
	WithRetries             bool
	MaxRetries              uint64
}

Jump to

Keyboard shortcuts

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