pgsql

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnection added in v1.2.6

func GetConnection(cfg *Config) (*sql.DB, error)

Types

type Config

type Config struct {
	Host     string `yaml:"Host"`
	Port     int    `yaml:"Port"`
	Username string `yaml:"Username"`
	Password string `yaml:"Password"`
	DBName   string `yaml:"DBName"`
	SSLMode  string `yaml:"SSLMode"`

	// Connection Pool Settings
	MaxOpenConns    int           `yaml:"MaxOpenConns"`    // Maximum number of open connections
	MaxIdleConns    int           `yaml:"MaxIdleConns"`    // Maximum number of idle connections
	ConnMaxLifetime time.Duration `yaml:"ConnMaxLifetime"` // Maximum amount of time a connection may be reused
	ConnMaxIdleTime time.Duration `yaml:"ConnMaxIdleTime"` // Maximum amount of time a connection may be idle
}

func (*Config) WithDefaults added in v1.2.6

func (c *Config) WithDefaults()

Jump to

Keyboard shortcuts

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