MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / RenderPostgresConfiguration

Function RenderPostgresConfiguration

pkg/configfile/configfile.go:127–134  ·  view source on GitHub ↗

RenderPostgresConfiguration returns a PostgreSQL configuration fragment as a single string: one `key = 'escaped value'\n` line per entry in options, sorted by key. The returned string is safe to concatenate with other fragments and to embed directly into a `postgresql.conf`-style file. This is the

(options map[string]string)

Source from the content-addressed store, hash-verified

125// that build strings by hand can forget to escape values, while this funnels
126// every value through the same escaping that the on-disk parser uses.
127func RenderPostgresConfiguration(options map[string]string) string {
128 var b strings.Builder
129 for _, l := range UpdateConfigurationContents(nil, options) {
130 b.WriteString(l)
131 b.WriteByte('\n')
132 }
133 return b.String()
134}
135
136// WritePostgresConfiguration replaces the content of a PostgreSQL configuration
137// file with the provided options

Callers 4

CreatePostgresqlConfFileFunction · 0.92
RestoreSnapshotMethod · 0.92
getRestoreWalConfigFunction · 0.92
BuildPostgresOptionsMethod · 0.92

Calls 2

StringMethod · 0.45

Tested by

no test coverage detected