Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GB = 1024 * MB
var KB = 1024
var LocaleParams = []string{
"lc_collate",
"lc_ctype",
"lc_messages",
"lc_monetary",
"lc_numeric",
"lc_time",
}
Locale-related parameters (applicable to initdb)
var MB = 1024 * KB
var PerformanceParams = []string{
"checkpoint_completion_target",
"default_statistics_target",
"effective_cache_size",
"effective_io_concurrency",
"huge_pages",
"maintenance_work_mem",
"max_connections",
"max_parallel_maintenance_workers",
"max_parallel_workers_per_gather",
"max_parallel_workers",
"max_wal_senders",
"max_wal_size",
"max_worker_processes",
"min_wal_size",
"random_page_cost",
"shared_buffers",
"wal_buffers",
"wal_level",
"work_mem",
}
GetPgTuneManagedParams returns the list of parameters managed by pg_tune
var StartupParams = []string{
"listen_addresses",
"port",
"max_wal_size",
"shared_buffers",
"wal_level",
"config-file",
"D",
"data-directory",
"ssl",
}
Functions ¶
func DefaultPostgresConf ¶
func DefaultPostgresConf() *pkg.PostgresConf
DefaultPostgresConf returns a PostgresConf with sensible defaults
func EnsureIncludeDirective ¶ added in v1.0.4
EnsureIncludeDirective ensures that postgresql.conf includes the specified file If the include directive doesn't exist, it will be added at the end
func LoadPostgresConf ¶
func LoadPostgresConf(filename string) (*pkg.PostgresConf, error)
LoadPostgresConf loads PostgreSQL configuration from a JSON file
Types ¶
type Conf ¶ added in v1.0.4
func LoadConfFile ¶ added in v1.0.4
func LoadPostmasterOpts ¶ added in v1.0.4
func (Conf) AsInitDBArgs ¶ added in v1.0.4
AsInitDBArgs converts initdb-applicable parameters to command-line arguments
func (Conf) ForInitDB ¶ added in v1.0.4
ForInitDB filters configuration to only include parameters applicable to initdb Returns locale and encoding settings needed for cluster initialization
func (Conf) ForTempServer ¶ added in v1.0.4
type ConfSettings ¶ added in v1.0.4
type ConfSettings []ConfigSetting
ConfSettings is a map of configuration parameter names to their full settings
func LoadSettingsFromQuery ¶ added in v1.0.4
func LoadSettingsFromQuery(records []map[string]any) (ConfSettings, error)
LoadSettingsFromQuery parses pg_settings query results into ConfSettings
func (ConfSettings) AsMap ¶ added in v1.0.4
func (cs ConfSettings) AsMap() map[string]ConfigSetting
func (ConfSettings) Pretty ¶ added in v1.0.4
func (cs ConfSettings) Pretty() api.Text
func (ConfSettings) ToConf ¶ added in v1.0.4
func (cs ConfSettings) ToConf() Conf
ToConf converts ConfSettings to a simple map of name->setting values
type ConfigSetting ¶ added in v1.0.4
type ConfigSetting struct {
Name string `json:"name,omitempty"`
Setting string `json:"setting,omitempty"`
Unit *string `json:"unit,omitempty"`
Category string `json:"category,omitempty"`
ShortDesc string `json:"short_desc,omitempty"`
ExtraDesc *string `json:"extra_desc,omitempty"`
Context string `json:"context,omitempty"`
Vartype string `json:"vartype,omitempty"`
Source string `json:"source,omitempty"`
MinVal *string `json:"min_val,omitempty"`
MaxVal *string `json:"max_val,omitempty"`
Enumvals []string `json:"enumvals,omitempty"`
BootVal string `json:"boot_val,omitempty"`
ResetVal string `json:"reset_val,omitempty"`
Sourcefile *string `json:"sourcefile,omitempty"`
Sourceline *int `json:"sourceline,omitempty"`
PendingRestart bool `json:"pending_restart,omitempty"`
}
ConfigSetting represents a single PostgreSQL configuration parameter with all metadata from pg_settings system view
func (ConfigSetting) GetBool ¶ added in v1.0.4
func (cs ConfigSetting) GetBool() (bool, error)
func (ConfigSetting) GetInt ¶ added in v1.0.4
func (cs ConfigSetting) GetInt() (int, error)
func (ConfigSetting) IsBytes ¶ added in v1.0.4
func (cs ConfigSetting) IsBytes() bool
func (ConfigSetting) String ¶ added in v1.0.4
func (cs ConfigSetting) String() string
type ControlData ¶ added in v1.0.4
type ControlData struct {
PgControlVersion int
CatalogVersion int
DatabaseSystemIdentifier string
DatabaseClusterState string
PgControlLastModified time.Time
LatestCheckpointLocation string
LatestCheckpointREDOLocation string
LatestCheckpointREDOWALFile string
LatestCheckpointTimeLineID int
LatestCheckpointTime time.Time
WalLevel string
WalLogHints string
MaxConnections int
MaxWorkerProcesses int
MaxWalSenders int
MaxPreparedXacts int
MaxLocksPerXact int
TrackCommitTimestamp string
DatabaseBlockSize int
WALBlockSize int
BytesPerWALSegment int
MaxIdentifierLength int
DataPageChecksumVersion int
}
func ParseControlData ¶ added in v1.0.4
func ParseControlData(output string) (*ControlData, error)