Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a struct which allows to use fluent API to create underlying instance of Watch.
func CreateWatch ¶
func CreateWatch(intervalMs int64) *Builder
CreateWatch creates instance of Builder providing fluent functions to customize watch
interval defines how frequently (in ms) file change events should be processed.
func (*Builder) Excluding ¶
func (wb *Builder) Excluding(exclusions ...string) *Builder
Excluding allows to define exclusion patterns (as glob expressions).
func (*Builder) OnPaths ¶
func (wb *Builder) OnPaths(paths ...string) (watch *Watch, err error)
OnPaths defines paths to be watched. If path is a directory it will recursively watch all files and subdirectories. If path is a file only this path is watched.
func (*Builder) WithHandlers ¶
func (wb *Builder) WithHandlers(handlers ...Handler) *Builder
WithHandlers allows to register instances of Handler which will react on file change events.
type Handler ¶
type Handler func(events []fsnotify.Event) error
Handler allows to define how to react on file changes event.
type Watch ¶
type Watch struct {
// contains filtered or unexported fields
}
Watch represents single file system watch and delegates change events to defined handler.
func (*Watch) Close ¶
func (w *Watch) Close()
Close attempts to close underlying fsnotify.Watcher. In case of failure it logs the error.