package iniconf

import "git.wntrmute.dev/kyle/goutils/config/iniconf"

Index

Variables

var DefaultSection = "default"

DefaultSection is the label for the default ini file section.

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.

Source Files

iniconf.go

Version
v1.7.7 (latest)
Published
Jun 15, 2024
Platform
linux/amd64
Imports
5 packages
Last checked
3 days ago

Tools for package owners.