config

package
v1.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

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 LoadWithFilePath(path string, config interface{}) error

func LoadWithReader

func LoadWithReader(reader io.Reader, config interface{}) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL