config

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Get 查询配置/环境变量
	Get func(string) string
)

Functions

func GetBool added in v1.4.0

func GetBool(key string) bool

func GetDuration added in v1.4.0

func GetDuration(key string) time.Duration

func GetEnvString added in v1.4.0

func GetEnvString(key string, defaultValue string) string

GetEnvString get value from env. application parameters take precedence over environment variables env := GetEnvString("APP_ENV", "")

func GetFloat64 added in v1.4.0

func GetFloat64(key string) float64

func GetInt added in v1.4.0

func GetInt(key string) int

func GetInt32 added in v1.4.0

func GetInt32(key string) int32

func GetInt64 added in v1.4.0

func GetInt64(key string) int64

func GetIntSlice added in v1.5.0

func GetIntSlice(key string) []int

func GetSizeInBytes added in v1.5.0

func GetSizeInBytes(key string) uint

func GetString added in v1.5.0

func GetString(key string) string

func GetStringMap added in v1.5.0

func GetStringMap(key string) map[string]interface{}

func GetStringMapString added in v1.5.0

func GetStringMapString(key string) map[string]string

func GetStringMapStringSlice added in v1.5.0

func GetStringMapStringSlice(key string) map[string][]string

func GetStringSlice added in v1.5.0

func GetStringSlice(key string) []string

func GetTime added in v1.4.0

func GetTime(key string) time.Time

func GetUint added in v1.5.0

func GetUint(key string) uint

func GetUint32 added in v1.5.0

func GetUint32(key string) uint32

func GetUint64 added in v1.5.0

func GetUint64(key string) uint64

func Load added in v1.5.0

func Load(path string) error

func Set added in v1.4.0

func Set(key string, value interface{})

Set 设置配置,仅用于测试

func Watch added in v1.5.0

func Watch()

Types

type Config

type Config struct {
	*viper.Viper
}

func File added in v1.4.0

func File(name string) *Config

File 根据文件名获取对应配置对象 如果要读取 foo.yaml 配置,可以 File("foo").Get("bar")

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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