Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is key not found. ErrNotFound = errors.New("key not found") // ErrTypeAssert is type assert error. ErrTypeAssert = errors.New("type assert error") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface {
Load() error
Scan(v any, opts ...DecoderConfigOption) error
ScanKey(key string, dst any, opts ...DecoderConfigOption) error
Value(key string) Value
Watch(key string, o Observer) error
Close() error
}
Config is a config interface.
type DecoderConfigOption ¶
type DecoderConfigOption func(*mapstructure.DecoderConfig)
type Option ¶
type Option func(*options)
Option is config option.
func WithDecoder ¶
WithDecoder with config decoder. DefaultDecoder behavior: If KeyValue.Format is non-empty, then KeyValue.Value will be deserialized into map[string]any and stored in the config cache(map[string]any) if KeyValue.Format is empty,{KeyValue.Key : KeyValue.Value} will be stored in config cache(map[string]any)
func WithLogger ¶
WithLogger with config logger. Deprecated: use global logger instead.
type Reader ¶
type Reader interface {
Merge(...*KeyValue) error
Value(string) (Value, bool)
Source() ([]byte, error)
Resolve() error
Map() map[string]any
}
Reader is config reader.
Click to show internal directories.
Click to hide internal directories.