Documentation ¶
Index ¶
- func WithEtcdOption(ctx context.Context, opts ...clientv3.OpOption) context.Context
- type EtcdConfiger
- func (e *EtcdConfiger) DIY(ctx context.Context, key string) (interface{}, error)
- func (e *EtcdConfiger) GetSection(ctx context.Context, section string) (map[string]string, error)
- func (e *EtcdConfiger) OnChange(ctx context.Context, key string, fn func(value string))
- func (e *EtcdConfiger) SaveConfigFile(ctx context.Context, filename string) error
- func (e *EtcdConfiger) Set(ctx context.Context, key, val string) error
- func (e *EtcdConfiger) Sub(ctx context.Context, key string) (config.Configer, error)
- func (e *EtcdConfiger) Unmarshaler(ctx context.Context, prefix string, obj interface{}, ...) error
- type EtcdConfigerProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EtcdConfiger ¶
type EtcdConfiger struct { config.BaseConfiger // contains filtered or unexported fields }
func (*EtcdConfiger) DIY ¶
func (e *EtcdConfiger) DIY(ctx context.Context, key string) (interface{}, error)
DIY return the original response from etcd be careful when you decide to use this
func (*EtcdConfiger) GetSection ¶
GetSection in this implementation, we use section as prefix
func (*EtcdConfiger) OnChange ¶
func (e *EtcdConfiger) OnChange(ctx context.Context, key string, fn func(value string))
TODO remove this before release v2.0.0
func (*EtcdConfiger) SaveConfigFile ¶
func (e *EtcdConfiger) SaveConfigFile(ctx context.Context, filename string) error
func (*EtcdConfiger) Set ¶
func (e *EtcdConfiger) Set(ctx context.Context, key, val string) error
Set do nothing and return an error I think write data to remote config center is not a good practice
func (*EtcdConfiger) Unmarshaler ¶
func (e *EtcdConfiger) Unmarshaler(ctx context.Context, prefix string, obj interface{}, opt ...config.DecodeOption) error
Unmarshaler is not very powerful because we lost the type information when we get configuration from etcd for example, when we got "5", we are not sure whether it's int 5, or it's string "5" TODO(support more complicated decoder)
type EtcdConfigerProvider ¶
type EtcdConfigerProvider struct { }
Click to show internal directories.
Click to hide internal directories.