viper

package
v1.5.21 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 52

Documentation

Index

Constants

This section is empty.

Variables

View Source
var C = viper.New()

Functions

func BuildVipers added in v1.1.0

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 added in v1.1.0

func GetEnvConfigCastInt(key string) int

func GetEnvConfigFloat

func GetEnvConfigFloat(key string) float64

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

func GetEnvConfigInt

func GetEnvConfigInt(key string) int64

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

func GetEnvConfigStringSlice added in v1.1.0

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 added in v1.1.2

func NewConfigToToml(configs string)

Types

type Viper added in v1.1.0

type Viper struct {
	C *viper.Viper
}

func LoadViperByFilename added in v1.1.0

func LoadViperByFilename(filename string) *Viper

func (*Viper) GetEnvConfig added in v1.1.0

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

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

func (*Viper) GetEnvConfigBool added in v1.1.0

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

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

func (*Viper) GetEnvConfigCastInt added in v1.1.0

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

func (*Viper) GetEnvConfigFloat added in v1.1.0

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

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

func (*Viper) GetEnvConfigInt added in v1.1.0

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

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

func (*Viper) GetEnvConfigStringSlice added in v1.1.0

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