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

postgres

package
v0.306.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package postgres provides PostgreSQL connection utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionString

func BuildConnectionString(cfg *Config) string

func BuildConnectionURI

func BuildConnectionURI(cfg *Config) string

BuildConnectionURI returns a postgresql:// URI suitable for pgloader.

func CheckPsqlVersion

func CheckPsqlVersion(minMajor int) (major, minor int, err error)

CheckPsqlVersion verifies psql meets a minimum major version.

func FindPsqlPath

func FindPsqlPath() (string, error)

FindPsqlPath locates a PostgreSQL psql client on PATH.

func OpenConnection

func OpenConnection(connStr string) (*sql.DB, error)

OpenConnection opens a PostgreSQL connection with sensible defaults.

func QuoteIdentifier

func QuoteIdentifier(name string) string

QuoteIdentifier escapes a PostgreSQL identifier.

func RedactPassword

func RedactPassword(connStr string) string

Types

type Config

type Config struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
	SSLMode  string
	Options  map[string]string
}

func ParseConnectionURI

func ParseConnectionURI(uri string) (*Config, error)

ParseConnectionURI supports both URI and keyword/value formats.

Jump to

Keyboard shortcuts

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