config

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 3 Imported by: 2 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Viper *viper.Viper

Viper Viper 库实例

Functions

func Add

func Add(name string, configuration map[string]interface{})

Add 新增配置项

func Env

func Env(envName string, defaultValue ...interface{}) interface{}

Env 读取环境变量,支持默认值

func Get

func Get(path string, defaultValue ...interface{}) interface{}

Get 获取配置项,允许使用点式获取,如:app.name

func GetBool

func GetBool(path string, defaultValue ...interface{}) bool

GetBool 获取 Bool 类型的配置信息

func GetFloat64

func GetFloat64(path string, defaultValue ...interface{}) float64

func GetInt

func GetInt(path string, defaultValue ...interface{}) int

GetInt 获取 Int 类型的配置信息

func GetInt64

func GetInt64(path string, defaultValue ...interface{}) int64

GetInt64 获取 Int64 类型的配置信息

func GetString

func GetString(path string, defaultValue ...interface{}) string

GetString 获取 String 类型的配置信息

func GetUint

func GetUint(path string, defaultValue ...interface{}) uint

GetUint 获取 Uint 类型的配置信息

func IsLocal

func IsLocal() bool

func IsProduction

func IsProduction() bool

func IsTesting

func IsTesting() bool

Types

type StrMap

type StrMap map[string]interface{}

StrMap 简写 —— map[string]interface{}

Jump to

Keyboard shortcuts

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