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)
| 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. |
| 127 | func 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 |
no test coverage detected