Help us shape the future of Go! Take the 2026 Go Developer Survey

postgres

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsForeignKeyViolation

func IsForeignKeyViolation(err error) bool

func IsNoRows

func IsNoRows(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error) bool

func IsUniqueViolationOn

func IsUniqueViolationOn(err error, constraint string) bool

IsUniqueViolationOn reports the violation of one index, which keeps a caller answering for a duplicate id from also answering for the next index the table gains.

func Module

func Module() app.Module

Module provides the *sql.DB pool a service queries through.

Types

type Config

type Config struct {
	URL string `config:"url" validate:"required"`

	MaxOpenConns    int           `config:"max_open_conns"     validate:"min=0"`
	MaxIdleConns    int           `config:"max_idle_conns"     validate:"min=0"`
	ConnMaxLifetime time.Duration `config:"conn_max_lifetime"  validate:"min=0"`
	ConnMaxIdleTime time.Duration `config:"conn_max_idle_time" validate:"min=0"`

	// ConnectTimeout bounds the ping at boot, which turns an unreachable
	// database into a failed boot instead of a hang.
	ConnectTimeout time.Duration `config:"connect_timeout" validate:"min=1s"`
}

Jump to

Keyboard shortcuts

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