Documentation
¶
Index ¶
- type Ini
- func (i Ini) Get(section, key string) (string, bool)
- func (i Ini) GetDefault(section, key, defaultValue string) string
- func (i Ini) HasSection(section string) bool
- func (i Ini) Keys(section string) []string
- func (i Ini) Load(source io.Reader) error
- func (i Ini) ReadFrom(source io.Reader) (int64, error)
- func (i Ini) Sections() []string
- func (i Ini) Set(section, key, value string)
- func (i Ini) Unset(section, key string)
- func (i Ini) Write(d io.Writer) error
- func (i Ini) WriteTo(d io.Writer) (int64, error)
- type IniSafe
- func (i *IniSafe) Get(section, key string) (string, bool)
- func (i *IniSafe) GetDefault(section, key, defaultValue string) string
- func (i *IniSafe) HasSection(section string) bool
- func (i *IniSafe) Keys(section string) []string
- func (i *IniSafe) Load(source io.Reader) error
- func (i *IniSafe) ReadFrom(source io.Reader) (int64, error)
- func (i *IniSafe) Sections() []string
- func (i *IniSafe) Set(section, key, value string)
- func (i *IniSafe) Unset(section, key string)
- func (i *IniSafe) Write(d io.Writer) error
- func (i *IniSafe) WriteTo(d io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ini ¶
Ini represents an INI file with sections and key-value pairs. Not thread-safe by default; use IniSafe for concurrent access.
func (Ini) Get ¶
Get returns a value for a given key. Use section "root" for entries at the beginning of the file.
func (Ini) GetDefault ¶ added in v0.1.0
GetDefault returns a value for a given key or the provided default if not found.
func (Ini) HasSection ¶ added in v0.1.0
HasSection checks if a section exists.
func (Ini) Load ¶
Load will parse source and merge loaded values. Deprecated: Use ReadFrom instead which implements io.ReaderFrom interface.
func (Ini) ReadFrom ¶ added in v0.1.0
ReadFrom implements the io.ReaderFrom interface. It parses the source and merges loaded values, returning the number of bytes read and any error.
type IniSafe ¶ added in v0.1.0
type IniSafe struct {
// contains filtered or unexported fields
}
IniSafe is a thread-safe wrapper around Ini.
func NewThreadSafe ¶ added in v0.1.0
func NewThreadSafe() *IniSafe
NewThreadSafe returns a new thread-safe Ini structure.
func (*IniSafe) GetDefault ¶ added in v0.1.0
GetDefault returns a value or default in a thread-safe manner.
func (*IniSafe) HasSection ¶ added in v0.1.0
HasSection checks if a section exists in a thread-safe manner.
func (*IniSafe) Load ¶ added in v0.1.0
Load parses source and merges loaded values in a thread-safe manner. Deprecated: Use ReadFrom instead which implements io.ReaderFrom interface.
func (*IniSafe) ReadFrom ¶ added in v0.1.0
ReadFrom implements the io.ReaderFrom interface with thread safety.
func (*IniSafe) Sections ¶ added in v0.1.0
Sections returns all section names in a thread-safe manner.