Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("key not found") // ErrNotFound is key not found.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface { Load() error Scan(v interface{}) error Value(key string) Value Watch(key string, o Observer) error Close() error }
Config is a config interface.
type Merge ¶ added in v2.7.2
type Merge func(dst, src interface{}) error
Merge is config merge func.
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]interface{} and stored in the config cache(map[string]interface{}) if KeyValue.Format is empty,{KeyValue.Key : KeyValue.Value} will be stored in config cache(map[string]interface{})
func WithMergeFunc ¶ added in v2.7.2
WithMergeFunc with config merge func.
func WithResolveActualTypes ¶ added in v2.8.0
WithResolveActualTypes with config resolver. bool input will enable conversion of config to data types
func WithResolver ¶ added in v2.0.1
WithResolver with config resolver.
type Reader ¶
type Reader interface { Merge(...*KeyValue) error Value(string) (Value, bool) Source() ([]byte, error) Resolve() error }
Reader is config reader.
type Value ¶
type Value interface { Bool() (bool, error) Int() (int64, error) Float() (float64, error) String() (string, error) Duration() (time.Duration, error) Slice() ([]Value, error) Map() (map[string]Value, error) Scan(interface{}) error Load() interface{} Store(interface{}) }
Value is config value interface.
Click to show internal directories.
Click to hide internal directories.