Documentation ¶
Index ¶
- Variables
- func GetBoolConf(key string) bool
- func GetConf(key string) interface{}
- func GetConfEnv() string
- func GetDurationConf(key string) time.Duration
- func GetFloat64Conf(key string) float64
- func GetIntConf(key string) int
- func GetStringConf(key string) string
- func GetStringMapConf(key string) map[string]interface{}
- func GetStringMapStringConf(key string) map[string]string
- func GetStringSliceConf(key string) []string
- func GetTimeConf(key string) time.Time
- func InitBaseConf(path string) error
- func InitConfEnv(configDir string) error
- func InitMySQLConf(path string) error
- func InitRedisConf(path string) error
- func IsSetConf(key string) bool
- type BaseConf
- type MySQLConf
- type MySQLMapConf
- type RedisConf
- type RedisMapConf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IConfBase *BaseConf IConfRedisMap *RedisMapConf IConfMySQLMap *MySQLMapConf )
全局变量
View Source
var ( IConfEnvPath string //配置文件目录路径 IConfEnv string //配置环境名 dev prod )
View Source
var ViperConfMap map[string]*viper.Viper
Functions ¶
func GetBoolConf ¶
func GetDurationConf ¶
func GetFloat64Conf ¶
func GetIntConf ¶
func GetStringConf ¶
================================================================= =============== 最原始的读取配置文件方法 ============== * =================================================================
func GetStringMapConf ¶
func GetStringMapStringConf ¶
func GetStringSliceConf ¶
func GetTimeConf ¶
func InitBaseConf ¶
================================== BaseConf =================================
func InitConfEnv ¶
============================================================================ ====初始化 配置文件环境=== 解析配置文件目录 eg:config=conf/dev/base.toml ConfEnvPath=conf/dev ConfEnv=dev * ============================================================================
func InitMySQLConf ¶
================================== MySQLMapConf 系列=================================
func InitRedisConf ¶
================================== RedisConf ================================= 访问案例:lib.IConfRedisMap.List["pro"].ProxyList
Types ¶
type BaseConf ¶
type BaseConf struct { Base struct { DebugMode string `mapstructure:"debug_mode"` TimeLocation string `mapstructure:"time_location"` } `mapstructure:"base"` Http struct { Addr string `mapstructure:"addr"` ReadTimeout int `mapstructure:"read_timeout"` WriteTimeout int `mapstructure:"write_timeout"` MaxHeaderBytes int `mapstructure:"max_header_bytes"` } `mapstructure:"ihttp"` }
type MySQLMapConf ¶
type RedisMapConf ¶
Click to show internal directories.
Click to hide internal directories.