pgsql

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: MIT Imports: 3 Imported by: 8

README

pgsql

Build Status Coverage Status Go Report Card GoDoc Sourcegraph

pgsql is the helper functions for postgres

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUniqueViolation

func IsUniqueViolation(err error, constraint string) bool

IsUniqueViolation checks is error unique_violation with given constraint, constraint can be empty to ignore constraint name checks

func RunInTx

func RunInTx(db *sql.DB, opts *TxOptions, fn func(*sql.Tx) error) error

RunInTx runs fn inside retryable transaction

func RunInTxContext

func RunInTxContext(ctx context.Context, db *sql.DB, opts *TxOptions, fn func(*sql.Tx) error) (err error)

RunInTxContext runs fn inside retryable transaction with context

Types

type TxOptions

type TxOptions struct {
	sql.TxOptions
	MaxAttempts int
}

TxOptions is the transaction options

Jump to

Keyboard shortcuts

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