Documentation
¶
Index ¶
- Constants
- Variables
- func Decode(blob []byte, v interface{}) (err error)
- func Encode(v interface{}) (out []byte, err error)
- type Ini
- func (ini *Ini) AddSection(name string, values map[string]string)
- func (ini *Ini) Data() map[string]Section
- func (ini *Ini) DefBool(key string, def bool) bool
- func (ini *Ini) DefInt(key string, def int) (val int)
- func (ini *Ini) DefString(key string, def string) string
- func (ini *Ini) Get(key string) (val string, ok bool)
- func (ini *Ini) GetBool(key string) (value bool, ok bool)
- func (ini *Ini) GetInt(key string) (val int, ok bool)
- func (ini *Ini) GetSection(name string) (sec map[string]string, ok bool)
- func (ini *Ini) GetString(key string) (val string, ok bool)
- func (ini *Ini) HasSection(name string) bool
- func (ini *Ini) LoadExists(files ...string) (err error)
- func (ini *Ini) LoadFiles(files ...string) (err error)
- func (ini *Ini) LoadStrings(strings ...string) (err error)
- func (ini *Ini) MergeData(data map[string]Section)
- func (ini *Ini) MustBool(key string) bool
- func (ini *Ini) MustInt(key string) int
- func (ini *Ini) MustString(key string) string
- func (ini *Ini) ReadFrom(in io.Reader) (n int64, err error)
- func (ini *Ini) Reset()
- func (ini *Ini) Set(key, val string, section ...string)
- func (ini *Ini) SetBool(key string, val bool, section ...string)
- func (ini *Ini) SetInt(key string, val int, section ...string)
- func (ini *Ini) SetOptions(opts Options)
- func (ini *Ini) SetSection(name string, values map[string]string)
- func (ini *Ini) SetString(key, val string, section ...string)
- func (ini *Ini) WriteTo(out io.Writer) (n int64, err error)
- func (ini *Ini) WriteToFile(file string) (n int64, err error)
- type Options
- type Section
Constants ¶
View Source
const (
DefSection = "__default"
)
Variables ¶
View Source
var DefOptions = Options{ParseEnv: true}
DefOptions
Functions ¶
Types ¶
type Ini ¶
type Ini struct {
// contains filtered or unexported fields
}
Ini data manager
func (*Ini) AddSection ¶
AddSection
func (*Ini) Get ¶
Get a value by key string. you can use '.' split for get value in a special section
func (*Ini) GetBool ¶
GetBool Looks up a value for a key in this section and attempts to parse that value as a boolean, along with a boolean result similar to a map lookup. of following(case insensitive):
- true
- false
- yes
- no
- off
- on
- 0
- 1
The `ok` boolean will be false in the event that the value could not be parsed as a bool
func (*Ini) GetSection ¶
GetSection
func (*Ini) MustString ¶
MustString get a string value, if not found return empty string
func (*Ini) Set ¶
Set a value to the section by key. if section is empty, will set to default section
func (*Ini) SetSection ¶
SetSection
Click to show internal directories.
Click to hide internal directories.