Documentation ¶
Index ¶
- type EntriesMap
- type Entry
- type EntryList
- type Ini
- func (ini *Ini) Add(sec, key, value string, comments ...string) *Entry
- func (ini *Ini) AddSection(section *Section)
- func (ini *Ini) Clear()
- func (ini *Ini) Copy(src *Ini)
- func (ini *Ini) Get(sec, key string) string
- func (ini *Ini) GetBool(sec, key string, defs ...bool) bool
- func (ini *Ini) GetDuration(sec, key string, defs ...time.Duration) time.Duration
- func (ini *Ini) GetFloat(sec, key string, defs ...float64) float64
- func (ini *Ini) GetInt(sec, key string, defs ...int) int
- func (ini *Ini) GetInt64(sec, key string, defs ...int64) int64
- func (ini *Ini) GetSection(name string) *Section
- func (ini *Ini) GetSize(sec, key string, defs ...int64) int64
- func (ini *Ini) GetString(sec, key string, defs ...string) string
- func (ini *Ini) IsEmpty() bool
- func (ini *Ini) LoadData(r io.Reader, multiple ...bool) (err error)
- func (ini *Ini) LoadFile(path string, multiple ...bool) error
- func (ini *Ini) LoadFileFS(fsys fs.FS, path string, multiple ...bool) error
- func (ini *Ini) Map() map[string]map[string]any
- func (ini *Ini) Merge(src *Ini)
- func (ini *Ini) NewSection(name string, comments ...string) *Section
- func (ini *Ini) RemoveSection(name string) (sec *Section)
- func (ini *Ini) Section(name string) (sec *Section)
- func (ini *Ini) SectionNames() []string
- func (ini *Ini) Sections() []*Section
- func (ini *Ini) Set(sec, key, value string, comments ...string) *Entry
- func (ini *Ini) String() string
- func (ini *Ini) StringMap() map[string]map[string]string
- func (ini *Ini) StringsMap() map[string]map[string][]string
- func (ini *Ini) WriteData(w io.Writer) (err error)
- func (ini *Ini) WriteFile(path string) error
- type Section
- func (sec *Section) Add(key string, value string, comments ...string) *Entry
- func (sec *Section) Clear()
- func (sec *Section) Comments() []string
- func (sec *Section) Copy(src *Section)
- func (sec *Section) Delete(key string)
- func (sec *Section) Get(key string) string
- func (sec *Section) GetBool(key string, defs ...bool) bool
- func (sec *Section) GetDuration(key string, defs ...time.Duration) time.Duration
- func (sec *Section) GetEntries(key string) []*Entry
- func (sec *Section) GetEntry(key string) *Entry
- func (sec *Section) GetFloat(key string, defs ...float64) float64
- func (sec *Section) GetInt(key string, defs ...int) int
- func (sec *Section) GetInt64(key string, defs ...int64) int64
- func (sec *Section) GetSize(key string, defs ...int64) int64
- func (sec *Section) GetString(key string, defs ...string) string
- func (sec *Section) GetValues(key string) []string
- func (sec *Section) Keys() []string
- func (sec *Section) Map() map[string]any
- func (sec *Section) Merge(src *Section)
- func (sec *Section) Name() string
- func (sec *Section) Remove(key string, value string) (e *Entry)
- func (sec *Section) Set(key string, value string, comments ...string) *Entry
- func (sec *Section) String() string
- func (sec *Section) StringMap() map[string]string
- func (sec *Section) StringsMap() map[string][]string
- func (sec *Section) Write(bw *bufio.Writer, eol string) error
- type Sections
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntriesMap ¶
type EntriesMap = cog.LinkedHashMap[string, *EntryList]
type EntryList ¶
type EntryList = cog.LinkedList[*Entry]
type Ini ¶
type Ini struct { EOL string // End of Line // contains filtered or unexported fields }
Ini INI file reader / writer
func (*Ini) AddSection ¶
AddSection add a section to INI, overwrite existing section
func (*Ini) GetBool ¶
GetBool get a bool value of the key from the section sec if not found or convert error, returns the default defs[0] bool value
func (*Ini) GetDuration ¶
GetDuration get a time.Duration value of the key from the section sec if not found or convert error, returns the default defs[0] Duration value
func (*Ini) GetFloat ¶
GetFloat get a float value of the key from the section sec if not found or convert error, returns the default defs[0] float value
func (*Ini) GetInt ¶
GetInt get a int value of the key from the section sec if not found or convert error, returns the default defs[0] int value
func (*Ini) GetInt64 ¶
GetInt64 get a int64 value of the key from the section sec if not found or convert error, returns the default defs[0] int64 value
func (*Ini) GetSection ¶
GetSection return a section with the specified name or nil if section not exists
func (*Ini) GetSize ¶
GetSize get a int64 size value of the key from the section sec if not found or convert error, returns the default defs[0] int value
func (*Ini) GetString ¶
GetString get a string value of the key from the section sec if not found, returns the default defs[0] string value
func (*Ini) LoadData ¶
LoadData load INI from io.Reader if multiple = true, allow multiple entry with same key
func (*Ini) LoadFile ¶
LoadFile load INI from file if multiple = true, allow multiple entry with same key
func (*Ini) LoadFileFS ¶
LoadFileFS load INI from file if multiple = true, allow multiple entry with same key
func (*Ini) NewSection ¶
NewSection create a section to INI, overwrite existing section
func (*Ini) RemoveSection ¶
RemoveSection remove a section from INI
func (*Ini) Section ¶
Section return a section with the specified name. if the section does not exists, create and add it to ini.
func (*Ini) SectionNames ¶
SectionNames returns the section array
func (*Ini) StringsMap ¶
StringsMap convert ini to map[string]map[string][]string
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section ini section
func NewSection ¶
NewSection create a INI section
func (*Section) GetBool ¶
GetBool get a bool value of the key from the section if not found or convert error, returns the default defs[0] bool value
func (*Section) GetDuration ¶
GetDuration get a time.Duration value of the key from the section if not found or convert error, returns the default defs[0] Duration value
func (*Section) GetEntries ¶
GetEntries get the key's entries from the section
func (*Section) GetFloat ¶
GetFloat get a float value of the key from the section if not found or convert error, returns the default defs[0] float value
func (*Section) GetInt ¶
GetInt get a int value of the key from the section if not found or convert error, returns the default defs[0] int value
func (*Section) GetInt64 ¶
GetInt64 get a int64 value of the key from the section if not found or convert error, returns the default defs[0] int64 value
func (*Section) GetSize ¶
GetSize get a int64 size value of the key from the section if not found or convert error, returns the default defs[0] int value
func (*Section) GetString ¶
GetString get a string value of the key from the section if not found, returns the default defs[0] string value
func (*Section) StringsMap ¶
StringsMap return the section's entries key.(string)/value.([]string) map