Documentation
¶
Index ¶
- Constants
- func GetEnv(env string) string
- func GetProperties(envParams ...string) (*properties.Properties, error)
- func GetTestProperties() (props *properties.Properties, err error)
- func NewConfig() (gone.Vampire, gone.GonerId)
- func NewConfigure() (gone.Goner, gone.GonerId)
- func ParseConfAnnotation(tag string) (key string, defaultVal string)
- func Priest(cemetery gone.Cemetery) error
- type Configure
- type PropertiesConfigure
Constants ¶
View Source
const SliceMaxSize = 100
Variables ¶
This section is empty.
Functions ¶
func GetProperties ¶
func GetProperties(envParams ...string) (*properties.Properties, error)
GetProperties 读取环境变量ENV,读取参数 --env 读取配置的目录:程序所在目录,程序运行目录 配置文件读取顺序:config/default.properties,config/${env}.properties,后面的覆盖前面的
func GetTestProperties ¶
func GetTestProperties() (props *properties.Properties, err error)
func ParseConfAnnotation ¶ added in v0.0.22
Types ¶
type Configure ¶
type Configure interface { //Get 将获取`key`所对应的值,值将写入到参数`v`中;参数`v`,只接受指针类型;如果`key`对应的值不存在,将使用defaultVal Get(key string, v any, defaultVal string) error }
Configure 配置接口
type PropertiesConfigure ¶
type PropertiesConfigure interface { FilterStripPrefix(prefix string) *properties.Properties Decode(x interface{}) error GetParsedDuration(key string, def time.Duration) time.Duration GetBool(key string, def bool) bool GetInt(key string, def int) int GetInt64(string, int64) int64 GetUint(string, uint) uint GetUint64(string, uint64) uint64 GetFloat64(string, float64) float64 GetString(string, string) string Len() int }
Click to show internal directories.
Click to hide internal directories.