config

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const SliceMaxSize = 100

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(env string) string

GetEnv 获取环境变量

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 NewConfig

func NewConfig() (gone.Vampire, gone.GonerId)

func NewConfigure

func NewConfigure() (gone.Goner, gone.GonerId)

func ParseConfAnnotation added in v0.0.22

func ParseConfAnnotation(tag string) (key string, defaultVal string)

func Priest

func Priest(cemetery gone.Cemetery) error

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
}

Jump to

Keyboard shortcuts

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