Documentation
¶
Index ¶
- Constants
- type AuthorizedExecutor
- type Database
- type PgBouncer
- func (b *PgBouncer) Config() (map[string]string, error)
- func (b *PgBouncer) Connect(ctx context.Context) error
- func (b *PgBouncer) Disable(ctx context.Context, databases ...string) error
- func (b *PgBouncer) GenerateConfig(host string) error
- func (b *PgBouncer) Pause(ctx context.Context) error
- func (b *PgBouncer) Reload(ctx context.Context) error
- func (b *PgBouncer) Resume(ctx context.Context) error
- func (b *PgBouncer) ShowDatabases(ctx context.Context) ([]Database, error)
Constants ¶
const AlreadyPausedError = "already suspended/paused"
const AlreadyResumedError = "pooler is not paused/suspended"
const PoolerError = "08P01"
These error codes are returned whenever PgBouncer is asked to PAUSE/RESUME, but is already in the given state.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizedExecutor ¶
type AuthorizedExecutor struct {
User, Password, Database, SocketDir, Port string
}
func (AuthorizedExecutor) Connection ¶
func (e AuthorizedExecutor) Connection() (*pgx.Conn, error)
type PgBouncer ¶
type PgBouncer struct { ConfigFile string ConfigTemplateFile string // template that can be rendered with Host value Executor executor }
func (*PgBouncer) Config ¶
Config generates a key value map of config parameters from the PgBouncer config template file
func (*PgBouncer) Connect ¶
Connect runs the most basic of commands (SHOW VERSION) against PgBouncer to ensure the connection is alive.
func (*PgBouncer) Disable ¶
Disable causes PgBouncer to reject all new client connections on the given databases. If no databases are supplied then this operation will apply to all PgBouncer databases.
func (*PgBouncer) GenerateConfig ¶
GenerateConfig writes new configuration to PgBouncer.ConfigFile
func (*PgBouncer) Pause ¶
Pause causes PgBouncer to buffer incoming queries while waiting for those currently processing to finish executing. The supplied timeout is applied to the Postgres connection.
func (*PgBouncer) Reload ¶
Reload will cause PgBouncer to reload configuration and live apply setting changes
func (*PgBouncer) ShowDatabases ¶
ShowDatabases extracts information from the SHOW DATABASES PgBouncer command, selecting columns about database host details. This is quite cumbersome to write, due to the inability to query select fields for database information, and the lack of guarantees about the ordering of the columns returned from the command.