Documentation ¶
Index ¶
- Constants
- type AuthorizedExecutor
- type Database
- type HostChanger
- type PGBouncer
- func (b *PGBouncer) Config() (map[string]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) ExecContext ¶
func (AuthorizedExecutor) QueryContext ¶
type HostChanger ¶
func (HostChanger) Run ¶
func (h HostChanger) Run(_, host string) error
Run receives new PGBouncer host values and will reload PGBouncer to point at the new host
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) 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 ¶
ShowDatabase extracts information from the SHOW DATABASE 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.