Documentation ¶
Index ¶
- type Config
- type ConfigFileProvider
- type Response
- type TConf
- func (c *TConf) Close() error
- func (c *TConf) Fetch(ctx context.Context, val *Response) *TConf
- func (c *TConf) Get(key string) interface{}
- func (c *TConf) UnmarshalAll(out interface{}) error
- func (c *TConf) UnmarshalKey(key string, out interface{}) error
- func (c *TConf) Watch(ctx context.Context, stop chan bool) *TConf
- func (c *TConf) WithOnConfigChanged(onChanged func(*Response)) *TConf
- type YAMLProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // k/v store center Client backends.Store // local file name. FileName string // config file processor ConfigFileProvider ConfigFileProvider }
Config configurations
type ConfigFileProvider ¶
type ConfigFileProvider interface { WriteConfig(values map[string]interface{}) error ReadConfig() ([]byte, error) Unmarshal([]byte) (map[string]interface{}, error) }
ConfigFileProvider local file processor
type TConf ¶
type TConf struct {
// contains filtered or unexported fields
}
func (*TConf) UnmarshalAll ¶
UnmarshalAll decode the all configurations into a struct
func (*TConf) UnmarshalKey ¶
UnmarshalKey decode the config of the key into a struct
func (*TConf) WithOnConfigChanged ¶
type YAMLProvider ¶
type YAMLProvider struct {
FileName string
}
YAMLProvider yaml processor
func (YAMLProvider) ReadConfig ¶
func (provider YAMLProvider) ReadConfig() (b []byte, err error)
ReadConfig read data from yaml
func (YAMLProvider) Unmarshal ¶
func (provider YAMLProvider) Unmarshal(bytes []byte) (m map[string]interface{}, err error)
Unmarshal convert byte type to slice type
func (YAMLProvider) WriteConfig ¶
func (provider YAMLProvider) WriteConfig(values map[string]interface{}) error
WriteConfig write to config file
Click to show internal directories.
Click to hide internal directories.