Documentation
¶
Overview ¶
Package configfile contains primitives needed to manage a configuration file with the syntax of PostgreSQL
Index ¶
- func CreateConnectionString(parameters map[string]string) string
- func EnsureIncludes(fileName string, filesToInclude ...string) (changed bool, err error)
- func RemoveOptionsFromConfigurationContents(lines []string, options ...string) []string
- func RenderPostgresConfiguration(options map[string]string) string
- func UpdateConfigurationContents(lines []string, options map[string]string) []string
- func UpdatePostgresConfigurationFile(fileName string, options map[string]string, managedOptions ...string) (changed bool, err error)
- func WritePostgresConfiguration(fileName string, options map[string]string) (changed bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConnectionString ¶
CreateConnectionString create a PostgreSQL connection string given the passed parameters, escaping them as necessary
func EnsureIncludes ¶ added in v1.19.6
EnsureIncludes makes sure the passed PostgreSQL configuration file has an include directive to every filesToInclude.
func RemoveOptionsFromConfigurationContents ¶ added in v1.19.6
RemoveOptionsFromConfigurationContents deletes all the lines containing one of the given options from the provided configuration content
func RenderPostgresConfiguration ¶ added in v1.28.3
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 canonical way to produce a config fragment in-memory: callers that build strings by hand can forget to escape values, while this funnels every value through the same escaping that the on-disk parser uses.
func UpdateConfigurationContents ¶
UpdateConfigurationContents search and replace options in a configuration file whose content is passed
func UpdatePostgresConfigurationFile ¶
func UpdatePostgresConfigurationFile( fileName string, options map[string]string, managedOptions ...string, ) (changed bool, err error)
UpdatePostgresConfigurationFile search and replace options in a Postgres configuration file. If any managedOptions is passed, it will be removed unless present in the options map. If the configuration file doesn't exist, it will be written.
Types ¶
This section is empty.