Documentation ¶
Overview ¶
Package conf 提供最基础的配置加载功能
Index ¶
- Variables
- func GetBool(key string) bool
- func GetDuration(key string) time.Duration
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt32(key string) int32
- func GetInt64(key string) int64
- func GetIntSlice(key string) []int
- func GetSizeInBytes(key string) uint
- func GetString(key string) string
- func GetStringMap(key string) map[string]interface{}
- func GetStringMapString(key string) map[string]string
- func GetStringMapStringSlice(key string) map[string][]string
- func GetStringSlice(key string) []string
- func GetTime(key string) time.Time
- func GetUint(key string) uint
- func GetUint32(key string) uint32
- func GetUint64(key string) uint64
- func OnConfigChange(run func())
- func Set(key string, value interface{})
- func WatchConfig()
- type Conf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Host 主机名 Host = "localhost" // App 服务标识 App = "localapp" // Env 运行环境 Env = "dev" // Zone 服务区域 Zone = "sh001" )
View Source
var Get func(string) string
Get 查询配置/环境变量
Functions ¶
func GetDuration ¶
func GetFloat64 ¶
func GetIntSlice ¶
func GetSizeInBytes ¶
func GetStringMap ¶
func GetStringMapString ¶
func GetStringMapStringSlice ¶
func GetStringSlice ¶
func OnConfigChange ¶
func OnConfigChange(run func())
OnConfigChange 注册配置文件变更回调 需要在 WatchConfig 之前调用
Types ¶
Click to show internal directories.
Click to hide internal directories.