Documentation
¶
Index ¶
- func DecodeToStruct(key string, out interface{}) error
- func Get(key string) interface{}
- func GetBool(key string) bool
- func GetDuration(key string) time.Duration
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt64(key string) int64
- func GetSlice(key string) []interface{}
- 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 LoadEngine(path string, opts ...Option)
- type Engine
- func (e *Engine) DecodeToStruct(key string, i interface{}) error
- func (e *Engine) Get(key string) interface{}
- func (e *Engine) GetBool(key string) bool
- func (e *Engine) GetDuration(key string) time.Duration
- func (e *Engine) GetFloat64(key string) float64
- func (e *Engine) GetInt(key string) int
- func (e *Engine) GetInt64(key string) int64
- func (e *Engine) GetSlice(key string) []interface{}
- func (e *Engine) GetString(key string) string
- func (e *Engine) GetStringMap(key string) map[string]interface{}
- func (e *Engine) GetStringMapString(key string) map[string]string
- func (e *Engine) GetStringMapStringSlice(key string) map[string][]string
- func (e *Engine) GetStringSlice(key string) []string
- func (e *Engine) GetTime(key string) time.Time
- func (e *Engine) Load(path string, opts ...Option) error
- type Logger
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeToStruct ¶
DecodeToStruct The external exposure api is used for decoding, which can decode the value of the key map to the out variable
func GetDuration ¶
GetDuration external exposure api to get time.Duration type value.
func GetFloat64 ¶
GetFloat64 external exposure api to get float64 type value.
func GetSlice ¶
func GetSlice(key string) []interface{}
GetSlice external exposure api to get []interface{} type value.
func GetStringMap ¶
GetStringMap external exposure api to get map[string]interface{} type value.
func GetStringMapString ¶
GetStringMapString external exposure api to get map[string]string type value.
func GetStringMapStringSlice ¶
GetStringMapStringSlice external exposure api to get map[string][]string type value.
func GetStringSlice ¶
GetStringSlice external exposure api to get []string type value.
func LoadEngine ¶
Types ¶
type Engine ¶
type Engine struct { RawData []byte // config file original data LevelSplit string // key get split WeaklyTypedInput bool // whether to startweak type conversion Logger *log.Logger // logger instance LocalStorage *base.LRUCache // fast cache Configure map[string]interface{} // original config Broker base.Broker // broker Capacity int // contains filtered or unexported fields }
conf-reload Engine,Used to coordinate and manage broker
func (*Engine) DecodeToStruct ¶
DecodeToStruct Depends on the work of broker decode If Map corresponding to key is nil, will return an error
func (*Engine) Get ¶
Get the value corresponding to the key from LocalStorage. If it is not available, it will be found in the broker
func (*Engine) GetDuration ¶
Engine.GetDuration returns the value associated with the key as time.Duration type.
func (*Engine) GetFloat64 ¶
Engine.GetFloat64 returns the value associated with the key as float64 type.
func (*Engine) GetSlice ¶
Engine.GetSlice returns the value associated with the key as []interface{} type.
func (*Engine) GetStringMap ¶
Engine.GetStringMap returns the value associated with the key as map[string]interface{} type.
func (*Engine) GetStringMapString ¶
Engine.GetStringMapString returns the value associated with the key as map[string]string type.
func (*Engine) GetStringMapStringSlice ¶
Engine.GetStringMapStringSlice returns the value associated with the key as map[string][]string type.
func (*Engine) GetStringSlice ¶
Engine.GetStringSlice returns the value associated with the key as []string type.
type Logger ¶
type Logger interface { // Debug logs a message at Debug level. Debug(args ...interface{}) // Info logs a message at Info level. Info(args ...interface{}) // Warn logs a message at Warning level. Warn(args ...interface{}) // Error logs a message at Error level. Error(args ...interface{}) // Fatal logs a message at Fatal level // and process will exit with status set to 1. Fatal(args ...interface{}) }
type Option ¶
type Option func(*Engine)
func WithCapacity ¶
func WithLevelSplit ¶
WithLevelSplit config file separator options
func WithLogger ¶
WithLogger Logger options, The logger must be implement Logger
func WithWeaklyTypedInput ¶
WithWeaklyTypedInput options Whether to start weak type conversion See details https://github.com/mitchellh/mapstructure/blob/main/mapstructure_examples_test.go