db

package
v0.0.0-...-f54f16c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PGOpen

func PGOpen(dataSourceName string, opts ...PGOpenOption) (*sql.DB, error)

func PGOpenContext

func PGOpenContext(ctx context.Context, dataSourceName string, userOpts ...PGOpenOption) (*sql.DB, error)

Types

type PGOpenOption

type PGOpenOption func(*dbOpts)

func WithMaxConnectionLifetime

func WithMaxConnectionLifetime(d time.Duration) PGOpenOption

WithMaxConnectionLifetime configures the maximum connection lifetime. The current default value is set based on the known pg-gateway and a2-backend timeouts. Consider carefully before changing. A zero duration disables the connection lifetime.

func WithMaxConnectionLifetimeJitter

func WithMaxConnectionLifetimeJitter(d time.Duration) PGOpenOption

WithMaxConnectionLifetimeJitter adds a random duration in the range of [0, d) to the configured MaxConnectionLifetime if it is non-zero.

func WithPingInterval

func WithPingInterval(d time.Duration) PGOpenOption

WithPingInterval configures a background goroutine that will ping the database every interval. A zero duration disables the pinger. Default: 20s

func WithPingJitter

func WithPingJitter(d time.Duration) PGOpenOption

WithPingJitter adds a random duration in the range of [o, d) to the PeriodicPingInterval. Default: 20s

func WithoutPinger

func WithoutPinger() PGOpenOption

WithoutPinger disables background pinging.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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