Documentation ¶
Index ¶
- Constants
- Variables
- type IniParser
- func (i *IniParser) GetBool(sectionKey string) (bool, error)
- func (i *IniParser) GetDuration(sectionKey string) (time.Duration, error)
- func (i *IniParser) GetFloat(sectionKey string) (float64, error)
- func (i *IniParser) GetInt(sectionKey string) (int64, error)
- func (i *IniParser) GetSection(section string) (map[string]string, error)
- func (i *IniParser) GetSlice(sectionKey string) ([]string, error)
- func (i *IniParser) GetString(sectionKey string) (string, error)
- func (i *IniParser) OnConfChange(run func(ev fsnotify.Event))
- func (i *IniParser) Parse()
- func (i *IniParser) Watch() error
Constants ¶
const ( EOF token = iota KEY_VALUE SECTION WHITESPACE NON_VALID COMMENT )
Variables ¶
var ( KEY_NOT_FOUND error = fmt.Errorf("key not found ") SEC_NOT_FOUND error = fmt.Errorf("sec not found ") NOT_BOOL = fmt.Errorf("Value is not a bool ") NOT_INT = fmt.Errorf("Value is not an int ") NOT_FLOAT = fmt.Errorf("Value is not a float ") NOT_STRING = fmt.Errorf("Value is not a string ") )
Functions ¶
This section is empty.
Types ¶
type IniParser ¶
type IniParser struct {
// contains filtered or unexported fields
}
func New ¶
New creates and parse a new configuration from a file name returns a valid parsed object and a nil, or an error and nil object in the successful case the values are ready to be retrieved
func (*IniParser) GetBool ¶
GetBool retrieves a bool value from named section with key name, returns either an error and an invalid value or a nil and a valid value.
func (*IniParser) GetDuration ¶
GetDuration retrieves a time.Duration value from the named section/key, returns either an error and an -1 or a valid duration and a nil error.
func (*IniParser) GetFloat ¶
GetFloat retrieves a float64 value from named section with key name, returns either an error and an invalid value or a nil and a valid value.
func (*IniParser) GetInt ¶
GetInt retrieves a int64 value from named section with key name, returns either an error and an invalid value or a nil and a valid value.
func (*IniParser) GetSection ¶
GetSection retrieves an entire section coverting the values to the appropriate type is left to the user everything is a string
func (*IniParser) GetSlice ¶
GetSlice retrieves a slice value from named section with key name, returns either an error and an invalid value or a nil and a valid value.
func (*IniParser) GetString ¶
GetString retrieves a string value from named section with key name, returns either an error and an invalid value or a nil and a valid value.
func (*IniParser) OnConfChange ¶
OnConfChange accept a single parameter, a function that gets run right after every event and receive a copy of it.