pqconn

package
v0.0.0-...-ab31a86 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Driver = "postgres"
)

Variables

View Source
var (
	ListenerMinReconnectInterval = time.Second * 10
	ListenerMaxReconnectInterval = time.Second * 60
	ListenerPingInterval         = time.Second * 90
)
View Source
var ListenerEventLogger sqldb.Logger

ListenerEventLogger will log all subscribed channel listener events if not nil

Functions

func GetRaisedException

func GetRaisedException(err error) string

GetRaisedException returns the message of an PL/pgSQL exception or and empty string if the error is nil or not an exception.

func IsCheckViolation

func IsCheckViolation(err error) bool

func IsExclusionViolation

func IsExclusionViolation(err error) bool

func IsForeignKeyViolation

func IsForeignKeyViolation(err error, violatedConstraints ...string) bool

func IsIntegrityConstraintViolationClass

func IsIntegrityConstraintViolationClass(err error) bool

func IsNotNullViolation

func IsNotNullViolation(err error) bool

func IsPLPGSQLErrorClass

func IsPLPGSQLErrorClass(err error) bool

func IsQueryCanceled

func IsQueryCanceled(err error) bool

IsQueryCanceled indicates if the passed error was caused by a user cancellation of a query. The pq error might not unwrap to context.Canceled even when it was caused by a context cancellation.

func IsRaisedException

func IsRaisedException(err error) bool

func IsRestrictViolation

func IsRestrictViolation(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error) bool

func MustNew

func MustNew(ctx context.Context, config *sqldb.Config) sqldb.Connection

MustNew creates a new sqldb.Connection using the passed sqldb.Config and github.com/lib/pq as driver implementation. The connection is pinged with the passed context, and only returned when there was no error from the ping. Errors are paniced.

func New

func New(ctx context.Context, config *sqldb.Config) (sqldb.Connection, error)

New creates a new sqldb.Connection using the passed sqldb.Config and github.com/lib/pq as driver implementation. The connection is pinged with the passed context and only returned when there was no error from the ping.

func WrapKnownErrors

func WrapKnownErrors(err error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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