viper

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var C = viper.New()

Functions

func BuildVipers

func BuildVipers(filePath string, fileName ...string)

func CheckToml added in v1.2.7

func CheckToml(configs string)

func GetEnvConfig

func GetEnvConfig(key string) string

获取配置文件优先获取环境变量(返回string类型)

func GetEnvConfigBool

func GetEnvConfigBool(key string) bool

获取配置文件优先获取环境变量(返回Bool类型)

func GetEnvConfigCastInt

func GetEnvConfigCastInt(key string) int

func GetEnvConfigFloat

func GetEnvConfigFloat(key string) float64

获取配置文件优先获取环境变量(返回Float类型)

func GetEnvConfigInt

func GetEnvConfigInt(key string) int64

获取配置文件优先获取环境变量(返回int类型)

func GetEnvConfigStringSlice

func GetEnvConfigStringSlice(key string) []string

func MerageConfigToToml added in v1.2.5

func MerageConfigToToml(configs string)

func NewConfig

func NewConfig(filePath string, fileName string)

初始化配置文件 filePath 配置文件路径 fileName 配置文件名称(不需要文件后缀)

func NewConfigToToml

func NewConfigToToml(configs string)

Types

type Viper

type Viper struct {
	C *viper.Viper
}

func LoadViperByFilename

func LoadViperByFilename(filename string) *Viper

func (*Viper) GetEnvConfig

func (V *Viper) GetEnvConfig(key string) string

获取配置文件优先获取环境变量(返回string类型)

func (*Viper) GetEnvConfigBool

func (V *Viper) GetEnvConfigBool(key string) bool

获取配置文件优先获取环境变量(返回Bool类型)

func (*Viper) GetEnvConfigCastInt

func (V *Viper) GetEnvConfigCastInt(key string) int

func (*Viper) GetEnvConfigFloat

func (V *Viper) GetEnvConfigFloat(key string) float64

获取配置文件优先获取环境变量(返回Float类型)

func (*Viper) GetEnvConfigInt

func (V *Viper) GetEnvConfigInt(key string) int64

获取配置文件优先获取环境变量(返回int类型)

func (*Viper) GetEnvConfigStringSlice

func (V *Viper) GetEnvConfigStringSlice(key string) []string

Jump to

Keyboard shortcuts

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