Documentation
¶
Index ¶
- Constants
- type Ini
- func (ini *Ini) GetFlattenedKeys() []string
- func (ini *Ini) GetKeys(sectionName string) ([]string, error)
- func (ini *Ini) GetLastModified() time.Time
- func (ini *Ini) GetProp(section string, key string) (val string, ok bool)
- func (ini *Ini) GetSectionNames() []string
- func (ini *Ini) LoadFromFile(file *os.File) error
- func (ini *Ini) LoadFromFilespec(filespec string) error
- func (ini *Ini) LoadFromReader(reader io.Reader) error
- func (ini *Ini) LoadFromString(s string) error
- func (ini *Ini) ToMap() map[string]string
- type Section
Constants ¶
const CR byte = 0x0D
CR is carriage return
const LF byte = 0x0A
LF is linefeed
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ini ¶ added in v1.0.2
type Ini struct {
// contains filtered or unexported fields
}
Ini provides parsing and querying of INI format or simple name/value pairs such as a simple config file. A name/value pair format is just an INI with no sections, and properties can be queried using an empty section name.
func (*Ini) GetFlattenedKeys ¶ added in v1.0.2
GetFlattenedKeys returns all section names plus keys as one flattened array.
func (*Ini) GetKeys ¶ added in v1.0.2
GetKeys returns the names of all keys in the specified section. Note, the returned key names are a snapshot in time, meaning other goroutines may change the contents of this INI as soon as the method returns.
func (*Ini) GetLastModified ¶ added in v1.0.2
GetLastModified returns the last modified timestamp of the INI contents.
func (*Ini) GetProp ¶ added in v1.0.2
GetProp returns the value of the specified key in the named section.
func (*Ini) GetSectionNames ¶ added in v1.0.2
GetSectionNames returns the names of all sections in this INI. Note, the returned section names are a snapshot in time, meaning other goroutines may change the contents of this INI as soon as the method returns.
func (*Ini) LoadFromFile ¶ added in v1.0.2
LoadFromFile loads an INI file from `os.File`.
func (*Ini) LoadFromFilespec ¶ added in v1.0.2
LoadFromFilespec loads an INI file from string containing path and filename.
func (*Ini) LoadFromReader ¶ added in v1.0.2
LoadFromReader loads an INI file from an `io.Reader`.
func (*Ini) LoadFromString ¶ added in v1.0.2
LoadFromString parses an INI from a string .
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section represents a section in an INI file. The section has a name, which is enclosed in square brackets in the file. The section also has an array of key/value pairs.
func (*Section) GetProp ¶
GetProp returns the value associated with the given key, or `ok=false` if key does not exist.
func (*Section) StringPropsOnly ¶
StringPropsOnly returns a string representation of this section without the section header.