Documentation ¶
Index ¶
Constants ¶
View Source
const Version = "1.4.0"
Version -
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook func(oldCfg, newCfg interface{})
Hook the handler of update events pass the value of configuration(not ptr) to avoiding changing it
type Watcher ¶
type Watcher interface { // Config return the copy of configuration struct // Example: // cfg := Config().(MyConfigStruct) Config() interface{} // Close close the watcher Close() error // AddHook add hooks for the update events of configuration AddHook(...Hook) // OnError add error handle for error cases OnError(func(error)) // Watch start watch the update events // It is blocked until the watcher is closed Watch() }
Watcher concern about the changes of configuration
func NewFileWatcher ¶ added in v1.3.0
NewFileWatcher returns new a Watcher for file system
func NewMockWatcher ¶ added in v1.4.0
NewMockWatcher new watcher with pointer of config stucture
Click to show internal directories.
Click to hide internal directories.