Help us shape the future of Go! Take the 2026 Go Developer Survey

watcher

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v0.2.3

type Event struct {
	Kind EventKind // what happened
	Name string    // file or folder name involved
	Dest string    // for KindOrganized: the destination; otherwise empty
	Err  error     // set when Kind is KindError
}

Event is a single piece of activity reported by Watcher.Start.

type EventKind added in v0.2.3

type EventKind int

EventKind identifies the type of activity reported to the watch output.

const (
	KindOrganized EventKind = 0 // a file was organized into a compartment
	KindCreated   EventKind = 1 // a new user folder appeared
	KindDeleted   EventKind = 2 // a user folder was deleted or renamed away
	KindError     EventKind = 3 // watcher or processing error
)

type WatchOptions

type WatchOptions struct {
	Directory string
	Preset    string
	Rules     []string
	Name      string
	Debounce  time.Duration
	Initial   bool
	DryRun    bool
}

WatchOptions configures watch mode

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher monitors a folder and sorts incoming files

func New

func New(opts WatchOptions) (*Watcher, error)

New creates a Watcher

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context, cb func(ev Event)) error

Start begins watching the target folder

Jump to

Keyboard shortcuts

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