Documentation
¶
Index ¶
- Constants
- func LoadWithFilePath(path string, config interface{}) error
- func LoadWithReader(reader io.Reader, config interface{}) error
- type Configurator
- func (c *Configurator) Kernel() *viper.Viper
- func (c *Configurator) LoadWithFilePath(path string, config interface{}) error
- func (c *Configurator) LoadWithReader(reader io.Reader, config interface{}) error
- func (c *Configurator) SetConfigType(configType string) *Configurator
- func (c *Configurator) SetTagName(tagName string) *Configurator
Constants ¶
View Source
const ( ConfigTypeJson = "json" ConfigTypeToml = "toml" ConfigTypeYaml = "yaml" ConfigTypeYml = "yml" ConfigTypeProperties = "properties" ConfigTypeProps = "props" ConfigTypeProp = "prop" ConfigTypeHcl = "hcl" ConfigTypeDotenv = "dotenv" ConfigTypeEnv = "env" ConfigTypeIni = "ini" )
Variables ¶
This section is empty.
Functions ¶
func LoadWithFilePath ¶
func LoadWithReader ¶
Types ¶
type Configurator ¶
type Configurator struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Configurator
func SetConfigType ¶
func SetConfigType(configType string) *Configurator
func SetTagName ¶
func SetTagName(tagName string) *Configurator
func (*Configurator) Kernel ¶
func (c *Configurator) Kernel() *viper.Viper
func (*Configurator) LoadWithFilePath ¶
func (c *Configurator) LoadWithFilePath(path string, config interface{}) error
func (*Configurator) LoadWithReader ¶
func (c *Configurator) LoadWithReader(reader io.Reader, config interface{}) error
LoadWithReader need point out the configType, default is json, can use SetConfigType to change
func (*Configurator) SetConfigType ¶
func (c *Configurator) SetConfigType(configType string) *Configurator
func (*Configurator) SetTagName ¶
func (c *Configurator) SetTagName(tagName string) *Configurator
Click to show internal directories.
Click to hide internal directories.