gormlib

package
v0.0.0-...-ef0d7b0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FdbErrNotCommitted        = "1020 - not_committed"
	FdbErrPastVersion         = "1007 - past_version"
	FdbErrOnlineDdlInProgress = "Online DDL in progress for"
)

Variables

View Source
var (
	// FdbRetryLimit is the maximum number of retries that will be attempted for db
	// errors which match the criteria to be classified as an operation that can
	// safely be retried [until it succeeds].
	FdbRetryLimit = 100
)

Functions

func ConfigureAliveSupport

func ConfigureAliveSupport(db *gorm.DB)

ConfigureAliveSupport sets up `Alive' soft-deletion support for the provided db instance.

func DbConnect

func DbConnect(driver string, connectionString string) (*gorm.DB, error)

func DbExecWithRetry

func DbExecWithRetry(db *gorm.DB, sql string, values ...interface{}) *gorm.DB

DbExecWithRetry executes a statement on a `*gorm.DB` connection and checks for retriable errors. If any are found, it will retry statement execution. See http://community.foundationdb.com/questions/42717/foundationdb-commit-aborted-1020-not-committed.html for more information about why this is sometimes necessary.

func DbFnWithRetry

func DbFnWithRetry(fn func() *gorm.DB) *gorm.DB

DbFnWithRetry is just like ExecWithRetry except that it takes any function that produces a `*gorm.DB`.

func IsRetriableDbError

func IsRetriableDbError(err error) bool

IsRetriableDbError checks an error to see if it is of the retriable foundationdb variety.

Types

This section is empty.

Jump to

Keyboard shortcuts

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