Documentation
¶
Index ¶
- Constants
- func GetWatchers() map[string][]func(name string, r *Response) error
- func KeyToDot(prefix ...string) string
- func RegisterFactory(name string, w Factory)
- func Watch(name string, callback func(name string, r *Response) error)
- type Cfg
- type Factory
- type Opt
- type Response
- type WatchHandler
- type Watcher
Constants ¶
View Source
const Name = "watcher"
Variables ¶
This section is empty.
Functions ¶
func RegisterFactory ¶
RegisterFactory 注册watcher build factory
Types ¶
type Cfg ¶
type Cfg struct {
Driver string `json:"driver"`
DriverCfg map[string]interface{} `json:"driver_config"`
SkipNull bool `json:"skip_null"`
// Projects 需要watcher的项目
Projects []string `json:"projects"`
}
func DefaultCfg ¶
func DefaultCfg() Cfg
type Factory ¶
func GetFactory ¶
type WatchHandler ¶
type Watcher ¶
type Watcher interface {
Init()
Close()
Get(ctx context.Context, key string, opts ...Opt) ([]*Response, error)
GetCallback(ctx context.Context, key string, fn func(resp *Response), opts ...Opt) error
Watch(ctx context.Context, key string, opts ...Opt) <-chan *Response
WatchCallback(ctx context.Context, key string, fn func(resp *Response), opts ...Opt)
}
Watcher ...
Click to show internal directories.
Click to hide internal directories.