iniconf

package
v1.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: BSD-2-Clause, ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSection = "default"

DefaultSection is the label for the default ini file section.

Functions

This section is empty.

Types

type ConfigMap

type ConfigMap map[string]map[string]string

ConfigMap is shorthand for the type used as a config struct.

func ParseFile

func ParseFile(fileName string) (cfg ConfigMap, err error)

ParseFile attempts to load the named config file.

func ParseReader

func ParseReader(r io.Reader) (cfg ConfigMap, err error)

ParseReader reads a configuration from an io.Reader.

func (ConfigMap) AddKeyVal

func (c ConfigMap) AddKeyVal(section, key, val string)

AddKeyVal adds a key value pair to a config map.

func (ConfigMap) AddSection

func (c ConfigMap) AddSection(section string)

AddSection creates a new section in the config map.

func (ConfigMap) GetValue

func (c ConfigMap) GetValue(section, key string) (val string, present bool)

GetValue retrieves the value from a key map.

func (ConfigMap) GetValueDefault

func (c ConfigMap) GetValueDefault(section, key, value string) (val string)

GetValueDefault retrieves the value from a key map if present, otherwise the default value.

func (ConfigMap) ListSections

func (c ConfigMap) ListSections() (sections []string)

ListSections returns the list of sections in the config map.

func (ConfigMap) SectionInConfig

func (c ConfigMap) SectionInConfig(section string) bool

SectionInConfig determines whether a section is in the configuration.

func (ConfigMap) SectionKeys

func (c ConfigMap) SectionKeys(section string) (keys []string, present bool)

SectionKeys returns the sections in the config map.

func (ConfigMap) WriteFile

func (c ConfigMap) WriteFile(filename string) (err error)

WriteFile writes out the configuration to a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL