postgresql

package
v0.0.0-...-2cd5006 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CI_KEYVAL int = iota
	CI_URI
)

Variables

This section is empty.

Functions

func DumpCreateDBAndACL

func DumpCreateDBAndACL(
	logger *logger.LevelLog,
	db *Pg,
	dbname string,
	pgDumpVersion int,
	force bool,
) (_ string, err error)

pg_dumpacl stuff

func DumpDBConfig

func DumpDBConfig(
	logger *logger.LevelLog,
	db *Pg,
	dbname string,
	pgDumpVersion int,
) (_ string, err error)

func ExtractFileFromSettings

func ExtractFileFromSettings(logger *logger.LevelLog, db *Pg, name string) (_ string, err error)

func ListDatabases

func ListDatabases(
	logger *logger.LevelLog,
	db *Pg,
	withTemplates bool,
	excludedDbs []string,
	includedDbs []string,
) ([]string, error)

func PauseReplicationWithTimeout

func PauseReplicationWithTimeout(logger *logger.LevelLog, db *Pg, timeOut int) error

func ResumeReplication

func ResumeReplication(logger *logger.LevelLog, db *Pg) error

func ShowSettings

func ShowSettings(logger *logger.LevelLog, db *Pg) (_ string, err error)

Types

type ConnInfo

type ConnInfo struct {
	Kind  int // See CI_* constants
	Infos map[string]string
}

func PrepareConnInfo

func PrepareConnInfo(host string, port int, username string, dbname string) (*ConnInfo, error)

PrepareConnInfo returns a connexion string computed from the input values. When the dbname is already a connection string or a postgresql:// URI, it only add the application_name keyword if not set.

func (*ConnInfo) Copy

func (c *ConnInfo) Copy() *ConnInfo

func (*ConnInfo) Del

func (c *ConnInfo) Del(keyword string) *ConnInfo

Del returns a pointer to a full copy of the conninfo with the key removed

func (*ConnInfo) MakeEnv

func (c *ConnInfo) MakeEnv() []string

MakeEnv return the conninfo as a list of "key=value" environment variables that the libpq understands, as stated in the documentation of PostgreSQL 14

func (*ConnInfo) Set

func (c *ConnInfo) Set(keyword, value string) *ConnInfo

Set returns a pointer to a full copy of the conninfo with the key added or the value updated

func (*ConnInfo) String

func (c *ConnInfo) String() string

type Pg

type Pg struct {
	Superuser bool
	// contains filtered or unexported fields
}

func DbOpen

func DbOpen(logger *logger.LevelLog, conninfo *ConnInfo) (*Pg, error)

func (*Pg) Close

func (db *Pg) Close() error

type PgPrivError

type PgPrivError struct {
	// contains filtered or unexported fields
}

func (*PgPrivError) Error

func (e *PgPrivError) Error() string

type PgVersionError

type PgVersionError struct {
	// contains filtered or unexported fields
}

func (*PgVersionError) Error

func (e *PgVersionError) Error() string

Jump to

Keyboard shortcuts

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