Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultHost = "localhost" DefaultPort = 5432 DefaultDatabase = "postgres" DefaultUser = "postgres" DefaultLoggerName = "pg" DefaultConnectionTimeout = 30 * time.Second DefaultPromotionTimeout = 30 * time.Second )
Variables ¶
View Source
var ( DefaultPasswordFile string = "N/A" ReplicationPromoteTriggerFile string = "N/A" )
View Source
var ( ErrNotInRecovery = errors.New("not in recovery") ErrPromotionTimeout = errors.New("promotion timeout") )
Functions ¶
Types ¶
type Cluster ¶
type Cluster interface { // Version returns Cluster version. Version() (major int, minor int, err error) // Alive returns Cluster liveness status. Alive() (bool, error) // InRecovery returns Cluster recovery status. InRecovery() (bool, error) // MasterInfo returns the master info Cluster is a replica of. MasterInfo() (*ConnectionInfo, error) // Stop stops Cluster. Stop() error // Start starts Cluster. Start() error // Promote promotes standby to master. Promote() error // Backup backs up Cluster from the host:port. Backup(host string, port int) error }
Cluster provides access to database.
type ConnectionInfo ¶
ConnectionInfo contains connection info.
type Option ¶
type Option func(*cluster)
Option defines configuration option.
func WithDatabase ¶
WithDatabase sets PostgreSQL database to connect.
func WithPasswordFile ¶
WithPasswordFile provides password file.
Click to show internal directories.
Click to hide internal directories.