Documentation
¶
Index ¶
- type File
- type Option
- func WithContext(ctx context.Context) Option
- func WithDisableTemplate(b bool) Option
- func WithFileNameFilter(f func(string) bool) Option
- func WithHandler(h func(File)) Option
- func WithInterval(d time.Duration) Option
- func WithLogger(f func(string, error)) Option
- func WithTemplateFuncs(fs map[string]any) Option
- func WithTemplateVars(data any) Option
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Watcher)
Option for watcher
func WithContext ¶
WithContext set a context for watcher. watcher will automatically stopped when context was canceled
func WithDisableTemplate ¶
WithDisableTemplate disable the template execution, watcher will parse the raw content in file to the Handler
func WithFileNameFilter ¶
WithFileNameFilter used to ignore some files in directories. such as some big file.
func WithHandler ¶
WithTemplateVars set the file handler for watcher. It will be called will file was changed or first found.
func WithInterval ¶
WithInterval set the interval for detecting changes of files. 10 seconds by default.
func WithLogger ¶
WithLogger customize the logger function
func WithTemplateFuncs ¶
WithTemplateVars customize the functions used to parse template
func WithTemplateVars ¶
WithTemplateVars customize the variables used to parse template