Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRemoveEvent ¶
func IsRemoveEvent(event fsnotify.Event) bool
Check if event is a deletion event using the fsnotify.Remove flag.
func RouteWatch ¶
func RouteWatch(ctx context.Context, logger *zap.Logger, rootAbsDir string, globManager FilepathChecker, eventReciever chan<- Event) error
Watches the specified directory or files changed.
Not that it is designed to be executed persistently.
Types ¶
type FilepathChecker ¶
type FilepathChecker interface { // Check if a file path meets the include/exclude conditions. // If it does not satisfy either conditions, will return [FilepathCheckerDefault]. IsInclude(absFilepath string) (FilepathCheckerResult, error) }
Check if a file path meets the include/exclude conditions. If it does not satisfy either conditions, will return [FilepathCheckerDefault].
type FilepathCheckerResult ¶
type FilepathCheckerResult int
Types result of checking path with glob rules in GlobRuleManager.
const ( GlobRuleDefault FilepathCheckerResult = iota GlobRuleInclude GlobRuleExclude )
type GlobRuleManager ¶
type GlobRuleManager struct {
// contains filtered or unexported fields
}
func NewGlobRuleManager ¶
func NewGlobRuleManager(rootDir string, prefferedRule GlobRuleType, includeGlobRules, excludeGlobRules []string) (*GlobRuleManager, error)
func (*GlobRuleManager) IsInclude ¶
func (m *GlobRuleManager) IsInclude(path string) (FilepathCheckerResult, error)
Check if a file path meets the include/exclude conditions. If it does not satisfy either conditions, will return [FilepathCheckerDefault].
type GlobRuleType ¶
type GlobRuleType bool
Types for file path glob rule (include/exclude).
const ( GlobIncludeRule GlobRuleType = false GlobExcludeRule GlobRuleType = true )
Click to show internal directories.
Click to hide internal directories.