watcher

package
v0.9.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation func() error

type Watcher

type Watcher struct {

	//	It's inherently an fsnotify Watcher under the hood.
	*fsnotify.Watcher

	//  In the following format:
	//  Key - Absolute File Name to Watch
	//  Value - Function to execute
	Map map[string]Operation
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) *Watcher

Initializes a new watcher

func (*Watcher) Register

func (w *Watcher) Register(path string, op Operation) error

Add individial location to watcher. Along with associating it with respectiove operation function.

func (*Watcher) Registered

func (w *Watcher) Registered(key string) bool

Validates whether a given key is already register in the watcher.

func (*Watcher) Start

func (w *Watcher) Start()

Infinite function which listens for fsnotify events once launched

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL