mysqlutils

package module
v0.0.0-...-117750b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: MIT Imports: 6 Imported by: 0

README

go-mysqlutils

Go MySQL utils.

GoDoc

Install

go get github.com/koofr/go-mysqlutils

Testing

go get -t
go test

Documentation

Index

Constants

View Source
const (
	ERROR_DUP_ENTRY         = 1062
	ERROR_LOCK_WAIT_TIMEOUT = 1205
	ERROR_LOCK_DEADLOCK     = 1213
	ERROR_QUERY_INTERRUPTED = 1317
	ERROR_NO_SUCH_TABLE     = 1146
)

Variables

View Source
var ErrForceRetry = errors.New("mysqlutils force retry")

Functions

func IsErrorIn

func IsErrorIn(err error, expectedErrorNumbers ...int) bool

func Retry

func Retry(ctx context.Context, db DB, retries int, expectedErrorNumbers ...int) func(f func(*sql.Tx) error) error

func RetryDefault

func RetryDefault(ctx context.Context, db *sql.DB, retries int) func(f func(*sql.Tx) error) error

Types

type DB

type DB interface {
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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