Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) AddConfig(section string, option string, value string) bool
- func (c *Config) Bool(key string) (bool, error)
- func (c *Config) Float64(key string) (float64, error)
- func (c *Config) Int(key string) (int, error)
- func (c *Config) Int64(key string) (int64, error)
- func (c *Config) Set(key string, value string) error
- func (c *Config) String(key string) string
- func (c *Config) Strings(key string) []string
- type ConfigInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DEFAULT_SECTION specifies the name of a section if no name provided DEFAULT_SECTION = "default" // DEFAULT_COMMENT defines what character(s) indicate a comment `#` DEFAULT_COMMENT = []byte{'#'} // DEFAULT_COMMENT_SEM defines what alternate character(s) indicate a comment `;` DEFAULT_COMMENT_SEM = []byte{';'} // DEFAULT_MULTI_LINE_SEPARATOR defines what character indicates a multi-line content DEFAULT_MULTI_LINE_SEPARATOR = []byte{'\\'} )
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config represents an implementation of the ConfigInterface
func (*Config) Bool ¶
Bool lookups up the value using the provided key and converts the value to a bool
func (*Config) Float64 ¶
Float64 lookups up the value using the provided key and converts the value to a float64
func (*Config) Int ¶
Int lookups up the value using the provided key and converts the value to a int
func (*Config) Int64 ¶
Int64 lookups up the value using the provided key and converts the value to a int64
type ConfigInterface ¶
type ConfigInterface interface { String(key string) string Strings(key string) []string Bool(key string) (bool, error) Int(key string) (int, error) Int64(key string) (int64, error) Float64(key string) (float64, error) Set(key string, value string) error }
ConfigInterface defines the behavior of a Config implemenation
func NewConfig ¶
func NewConfig(confName string) (ConfigInterface, error)
NewConfig create an empty configuration representation from file.
func NewConfigFromText ¶ added in v0.9.0
func NewConfigFromText(text string) (ConfigInterface, error)
NewConfigFromText create an empty configuration representation from text.
Click to show internal directories.
Click to hide internal directories.