Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWatcher ¶
func AddWatcher(cache emoji.Entertainer, file string, opts ...Option) error
AddWatcher initializes a file watcher on the given file.
If the file changes, the Entertainer cache will be reloaded from this file. The file will be watched in a separate go routine.
Use WithDeadline to pass a context which will signal the go routine to free any resources it holds and terminate. By default, context.Background() will be used.
Use WithLogger to receive any log messages from the file watcher. Log messages during the Reload will be reported by the emoji cache.
Types ¶
type ErrInvalidParameters ¶
type ErrInvalidParameters struct{}
ErrInvalidParameters represents the error for passing invalid parameters.
func (*ErrInvalidParameters) Error ¶
func (e *ErrInvalidParameters) Error() string
Error implements the Error interface.
type Option ¶
type Option func(w *watcher)
Option represents the function signature for options when instantiating an emoji file-watcher.
func WithDeadline ¶
WithDeadline adds a context which DOne signal will trigger the file-watcher go routine to clean up orderly and terminate.
func WithLogger ¶
WithLogger adds a basic Logger interface for reporting info & error messages from the file-watcher.