Documentation ¶
Overview ¶
A go implementation in the spirit of the python ConfigParser
Index ¶
- type ConfigParser
- func (c *ConfigParser) Get(section, option string) (val string, err error)
- func (c *ConfigParser) Getbool(section, option string) (val bool, err error)
- func (c *ConfigParser) Getfloat(section, option string) (val float64, err error)
- func (c *ConfigParser) Getint(section, option string) (val int, err error)
- func (c *ConfigParser) Options(section string) (res []string, err error)
- func (c *ConfigParser) Read(r io.Reader) (err error)
- func (c *ConfigParser) ReadFile(path string) (err error)
- func (c *ConfigParser) ReadString(s string) (err error)
- func (c *ConfigParser) Sections() (res []string)
- type NoOptionError
- type NoSectionError
- type Section
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigParser ¶
type ConfigParser struct { // allow data with no ["section"] header via Get("", key) AllowNoSectionHeader bool // contains filtered or unexported fields }
func (*ConfigParser) Get ¶
func (c *ConfigParser) Get(section, option string) (val string, err error)
Return the option for the given section as string or an error
func (*ConfigParser) Getbool ¶
func (c *ConfigParser) Getbool(section, option string) (val bool, err error)
Return the option for the given section as boolean or an error
func (*ConfigParser) Getfloat ¶
func (c *ConfigParser) Getfloat(section, option string) (val float64, err error)
Return the option for the given section as float or an error
func (*ConfigParser) Getint ¶
func (c *ConfigParser) Getint(section, option string) (val int, err error)
Return the option for the given section as integer or an error
func (*ConfigParser) Options ¶
func (c *ConfigParser) Options(section string) (res []string, err error)
Return a string slice of the options available in the given section
func (*ConfigParser) Read ¶
func (c *ConfigParser) Read(r io.Reader) (err error)
Attempt to parse the given io.Reader as a configuration It may return a error if the reading fails
func (*ConfigParser) ReadFile ¶
func (c *ConfigParser) ReadFile(path string) (err error)
Attempt to parse the given file as a configuration It may return a error if the parsing fails
func (*ConfigParser) ReadString ¶
func (c *ConfigParser) ReadString(s string) (err error)
Attempt to parse the given string as a configuration It may return a error if the parsing fails
func (*ConfigParser) Sections ¶
func (c *ConfigParser) Sections() (res []string)
Return a string slice of the sections available
type NoOptionError ¶
type NoOptionError struct {
// contains filtered or unexported fields
}
func (NoOptionError) Error ¶
func (e NoOptionError) Error() string
type NoSectionError ¶
type NoSectionError struct {
// contains filtered or unexported fields
}
func (NoSectionError) Error ¶
func (e NoSectionError) Error() string