postgres

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPostgreSQLErrorCode

func IsPostgreSQLErrorCode(err error, code PostgreSQLErrorCode) (*pgconn.PgError, bool)

func QuoteBytes

func QuoteBytes(buf []byte) string

copy-pasta from pgx internals, see https://github.com/jackc/pgx/blob/master/internal/sanitize/sanitize.go

func QuoteString

func QuoteString(str string) string

copy-pasta from pgx internals, see https://github.com/jackc/pgx/blob/master/internal/sanitize/sanitize.go

func RetryOnErrorCode

func RetryOnErrorCode(code PostgreSQLErrorCode, codes ...PostgreSQLErrorCode) func(context.Context, error) bool

Types

type PostgreSQLErrorCode

type PostgreSQLErrorCode string
var (
	SerializationFailure PostgreSQLErrorCode = "40001"
	// InvalidCatalogName often indicates attempting to connect to a database that
	// does not exist
	InvalidCatalogName PostgreSQLErrorCode = "3D000"
	// CannotConnectNow often indicates the server is still starting up
	CannotConnectNow PostgreSQLErrorCode = "57P03"
	DeadlockDetected PostgreSQLErrorCode = "40P01"
)

Jump to

Keyboard shortcuts

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