postgresql

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package postgresql provides a run.Config implementation to create a pgx Pool.

Index

Constants

View Source
const (
	DSN                = "dsn"
	ReadOnlyDSN        = "dsn-read-only"
	MaxIdleConnections = "max-idle-connections"
	MaxOpenConnections = "max-open-connections"
	MaxConnLifetime    = "max-connections-lifetime"
	MaxConnIdleTime    = "max-connections-idletime"
)

package flags.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Prefix             string
	DSN                string
	DSNRead            string
	MaxIdleConnections int32
	MaxOpenConnections int32
	MaxConnLifetime    time.Duration
	MaxConnIdleTime    time.Duration
	// contains filtered or unexported fields
}

Config implements run.Config to allow configuration of a db connection pool.

func (*Config) FlagSet

func (c *Config) FlagSet() *run.FlagSet

FlagSet implements run.Config.

func (*Config) Name

func (c *Config) Name() string

Name implements run.Unit.

func (*Config) Pool

func (c *Config) Pool() *pgxpool.Pool

Pool returns the established database connection pool handler.

func (*Config) PreRun

func (c *Config) PreRun() error

PreRun implements run.PreRunner.

func (*Config) ReadOnlyPool

func (c *Config) ReadOnlyPool() *pgxpool.Pool

ReadOnlyPool returns the established read-only database connection pool handler. If no read-only connection pool is established, the default pool will be returned.

func (*Config) Validate

func (c *Config) Validate() error

Validate implements run.Config.

Jump to

Keyboard shortcuts

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