Documentation ¶
Index ¶
- type Config
- type Section
- func (sect *Section) Add(option string, value string) bool
- func (sect *Section) Bool(option string) (bool, error)
- func (sect *Section) Bytes(option string) ([]byte, error)
- func (sect *Section) Duration(option string) (time.Duration, error)
- func (sect *Section) Float(option string) (float64, error)
- func (sect *Section) ID() string
- func (sect *Section) Int(option string) (int, error)
- func (sect *Section) String(option string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents configuration settings.
func New ¶
New creates a Config from config files; or returns an error if any of the files couldn't be opened/parsed.
The passed-in prefix is used to filter environment variables meant to overwrite config values of the files.
func (*Config) HasSection ¶
HasSection tests whether a section exists.
func (*Config) SectionMust ¶
SectionMust returns the section from the config that matches the passed-in name; or panics if it does not exist. If there are multiple sections with the same name the optional passed-in id decides which to use.
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section represents a named group of configuration options.
func (*Section) Add ¶
Add adds a new option and value to the configuration. It returns true if the option and value were inserted, and false if the value was overwritten.
func (*Section) Bool ¶
Bool returns the boolean value of the option; or an error if the conversion failed / the value didn't exist.
func (*Section) Bytes ¶
Bytes returns the raw byte array of the option; or an error if the conversion failed / the value didn't exist.
func (*Section) Duration ¶
Duration returns the time duration value of the option; or an error if the conversion failed / the value didn't exist.
func (*Section) Float ¶
Float returns the decimal value of the option; or an error if the conversion failed / the value didn't exist.