hotreload

package
v0.0.0-...-cfeb2ff Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Overview

Package hotreload is func library that implement reload service on development stage. # This manifest was generated by ymir. DO NOT EDIT.

Package hotreload is func library that implement reload service on development stage. # This manifest was generated by ymir. DO NOT EDIT.

Package hotreload is func library that implement reload service on development stage. # This manifest was generated by ymir. DO NOT EDIT.

Package hotreload is func library that implement reload service on development stage. # This manifest was generated by ymir. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(opts ...Option) (func() error, error)

Types

type FileWatcherEvent

type FileWatcherEvent struct {
	Filenames []string
}

FileWatcherEvent event watcher data.

type Option

type Option = func(c *Options) error

Option is Configure type return func.

func WithDirs

func WithDirs(dirs []string) Option

WithDirs will assign to field dirs Configure.

func WithLogger

func WithLogger(log zerolog.Logger) Option

WithLogger will assign to field logger Configure.

type Options

type Options struct {
	Dirs   []string
	Logger zerolog.Logger
}

Options is data structure for hotreload initialize.

type Watcher

type Watcher interface {
	Start(ctx context.Context)
	Stop() error
	Add(filename string) error
	EventsCh() chan *FileWatcherEvent
}

Watcher abstract of fileWatcher instances.

func NewFileWatcher

func NewFileWatcher(dirs []string, logger zerolog.Logger) (Watcher, error)

NewFileWatcher create a file watcher that will watch all the files/folders from configFiles if success a fileWatcher will be returned and a nil error otherwise an error and a nil fileWatcher are returned.

type Worker

type Worker interface {
	Run() error
	Reload()
}

Worker abstract of worker instances.

func NewWorker

func NewWorker(dir string, args ...string) Worker

NewWorker create new worker instance.

Jump to

Keyboard shortcuts

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