pgsql

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	host string,
	port uint16,
	user string,
	name string,
	sslmode string,
	options ...Option,
) (*sql.DB, error)

...

func NewFromConfig

func NewFromConfig(conf Config) (*sql.DB, error)

...

Types

type Config

type Config struct {
	Hostname     string        `koanf:"hostname"`
	Port         uint16        `koanf:"port" default:"5432"`
	Username     string        `koanf:"username"`
	Password     string        `koanf:"password"`
	Name         string        `koanf:"name"`
	SSLMode      string        `koanf:"sslmode" default:"verify-full"`
	MaxIdleTime  time.Duration `koanf:"maxidletime" default:"5m"`
	MaxLifetime  time.Duration `koanf:"maxlifetime" default:"5m"`
	MaxIdleConns int           `koanf:"maxidleconns"`
	MaxOpenConns int           `koanf:"maxopenconns"`
}

...

type Option

type Option interface {
	// contains filtered or unexported methods
}

...

func WithMaxIdleConns

func WithMaxIdleConns(count int) Option

...

func WithMaxIdleTime

func WithMaxIdleTime(d time.Duration) Option

...

func WithMaxLifetime

func WithMaxLifetime(d time.Duration) Option

...

func WithMaxOpenConns

func WithMaxOpenConns(count int) Option

...

func WithPassword

func WithPassword(password string) Option

...

Jump to

Keyboard shortcuts

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