Documentation ¶
Index ¶
- Variables
- func Contains(input []Entry, needle string) bool
- func OnlyNames(input []Entry) []string
- func WatchDir(ctx context.Context, inputPath string, recursiveDepth uint8, includeRoot bool, ...)
- type DateEntitiesFilter
- type DateWatchFilter
- type DirEntitiesFilter
- type DirWatchFilter
- type EntriesFilter
- type Entry
- type FileEntitiesFilter
- type FileWatchFilter
- type OpWatchFilter
- type PermissionsEntitiesFilter
- type PermissionsWatchFilter
- type RegexEntitiesFilter
- type RegexWatchFilter
- type SizeEntitiesFilter
- type SizeWatchFilter
- type SkipMapEntitiesFilter
- type SkipMapWatchFilter
- type WatchEvent
- type WatchFilter
Constants ¶
This section is empty.
Variables ¶
var MaxDepth uint8 = 255 // arbitrary, but hopefully enough
Functions ¶
func OnlyNames ¶ added in v0.6.0
OnlyNames returns a slice of absolute paths (strings) from a given Entry slice.
func WatchDir ¶ added in v0.12.0
func WatchDir(ctx context.Context, inputPath string, recursiveDepth uint8, includeRoot bool, files chan WatchEvent, errors chan error, filters ...WatchFilter)
WatchDir will watch a directory indefinitely for changes and publish them on the given files channel with optional filters.
Types ¶
type DateEntitiesFilter ¶ added in v0.12.0
type DateEntitiesFilter struct {
// contains filtered or unexported fields
}
DateEntitiesFilter filters fs events by matching ensuring ModTime is within the given date range.
func NewDateEntitiesFilter ¶ added in v0.12.0
func NewDateEntitiesFilter(from, to time.Time) DateEntitiesFilter
type DateWatchFilter ¶ added in v0.12.0
type DateWatchFilter struct {
// contains filtered or unexported fields
}
DateWatchFilter filters fs events by matching ensuring ModTime is within the given date range.
func NewDateWatchFilter ¶ added in v0.12.0
func NewDateWatchFilter(from, to time.Time) DateWatchFilter
type DirEntitiesFilter ¶ added in v0.14.0
type DirEntitiesFilter struct { }
DirEntitiesFilter only returns sub directories of the target.
func NewDirEntitiesFilter ¶ added in v0.14.0
func NewDirEntitiesFilter() DirEntitiesFilter
type DirWatchFilter ¶ added in v0.14.0
type DirWatchFilter struct{}
DirWatchFilter only returns sub directories of the target.
func NewDirWatchFilter ¶ added in v0.14.0
func NewDirWatchFilter() DirWatchFilter
type EntriesFilter ¶ added in v0.12.0
type EntriesFilter interface {
// contains filtered or unexported methods
}
EntitiesFilter interface facilitates filtering entry slices.
type Entry ¶ added in v0.6.0
Entry is the currency of this package.
func FilterEntities ¶ added in v0.12.0
func FilterEntities(files []Entry, filters ...EntriesFilter) []Entry
FilterEntities removes files from the slice if they are not accepted by the given filter function.
func List ¶ added in v0.14.0
func List(inputPath string, levelsDeep uint8, includeRoot bool, filters ...EntriesFilter) ([]Entry, error)
List is just a convience function to get a slice of files
func NewEntry ¶ added in v0.12.0
func NewEntry(inputPath string, levelsDeep uint8, filters ...EntriesFilter) (Entry, error)
NewEntry is the public constructor for creating an Entry. The levelsDeep param controls the level of recursion when collecting file info in subdirectories. levelsDeep == 0 will only create an entry for inputPath. Consider the number of files that may be under the root directory and the memory required to represent them when choosing this value.
func (*Entry) Flatten ¶ added in v1.16.0
List recursively lists all files with optional filters. If includeRoot is true the root directory "inputPath" is included in the results.
func (*Entry) Get ¶ added in v1.15.0
Get fulfils the flag.Getter interface https://pkg.go.dev/flag#Getter.
func (*Entry) Set ¶ added in v1.15.0
Set fulfils the flag.Value interface https://pkg.go.dev/flag#Value.
func (*Entry) String ¶ added in v0.6.0
String fulfils the flag.Value interface https://pkg.go.dev/flag#Value.
type FileEntitiesFilter ¶ added in v0.14.0
type FileEntitiesFilter struct { }
FileEntitiesFilter only returns files.
func NewFileEntitiesFilter ¶ added in v0.14.0
func NewFileEntitiesFilter() FileEntitiesFilter
type FileWatchFilter ¶ added in v0.14.0
type FileWatchFilter struct{}
FileWatchFilter only returns files.
func NewFileWatchFilter ¶ added in v0.14.0
func NewFileWatchFilter() FileWatchFilter
type OpWatchFilter ¶ added in v0.13.0
OpWatchFilter filters fs events by fsnotify.Op event type.
func NewOpWatchFilter ¶ added in v0.13.0
func NewOpWatchFilter(ops ...fsnotify.Op) OpWatchFilter
type PermissionsEntitiesFilter ¶ added in v0.12.0
type PermissionsEntitiesFilter struct {
// contains filtered or unexported fields
}
PermissionsEntitiesFilter filters fs events by ensuring the given file permissions are within the given range.
func NewPermissionsEntitiesFilter ¶ added in v0.12.0
func NewPermissionsEntitiesFilter(min, max uint32) PermissionsEntitiesFilter
type PermissionsWatchFilter ¶ added in v0.12.0
type PermissionsWatchFilter struct {
// contains filtered or unexported fields
}
PermissionsWatchFilter filters fs events by ensuring the given file permissions are within the given range.
func NewPermissionsWatchFilter ¶ added in v0.12.0
func NewPermissionsWatchFilter(min, max uint32) PermissionsWatchFilter
type RegexEntitiesFilter ¶ added in v0.12.0
type RegexEntitiesFilter struct {
// contains filtered or unexported fields
}
RegexEntitiesFilter filters fs events by matching file names to a given regex.
func NewRegexEntitiesFilter ¶ added in v0.12.0
func NewRegexEntitiesFilter(filterRegex *regexp.Regexp) RegexEntitiesFilter
type RegexWatchFilter ¶ added in v0.12.0
type RegexWatchFilter struct {
// contains filtered or unexported fields
}
RegexWatchFilter filters fs events by matching file names to a given regex.
func NewRegexWatchFilter ¶ added in v0.12.0
func NewRegexWatchFilter(filterRegex *regexp.Regexp) RegexWatchFilter
type SizeEntitiesFilter ¶ added in v0.12.0
type SizeEntitiesFilter struct {
// contains filtered or unexported fields
}
SizeEntitiesFilter filters fs events by ensuring the given file within the given size range (in bytes).
func NewSizeEntitiesFilter ¶ added in v0.12.0
func NewSizeEntitiesFilter(min, max int64) SizeEntitiesFilter
type SizeWatchFilter ¶ added in v0.12.0
type SizeWatchFilter struct {
// contains filtered or unexported fields
}
SizeWatchFilter filters fs events by ensuring the given file within the given size range (in bytes). Directories are always returned true.
func NewSizeWatchFilter ¶ added in v0.12.0
func NewSizeWatchFilter(min, max int64) SizeWatchFilter
type SkipMapEntitiesFilter ¶ added in v0.12.0
type SkipMapEntitiesFilter struct {
// contains filtered or unexported fields
}
SkipMapEntitiesFilter filters fs events by ensuring the given file is NOT within the given map.
func NewSkipMapEntitiesFilter ¶ added in v0.12.0
func NewSkipMapEntitiesFilter(skipMap map[string]struct{}) SkipMapEntitiesFilter
type SkipMapWatchFilter ¶ added in v0.12.0
type SkipMapWatchFilter struct {
// contains filtered or unexported fields
}
SkipMapWatchFilter filters fs events by ensuring the given file is NOT within the given map.
func NewSkipMapWatchFilter ¶ added in v0.12.0
func NewSkipMapWatchFilter(skipMap map[string]struct{}) SkipMapWatchFilter
type WatchEvent ¶ added in v0.12.1
WatchEvent is a wrapper for Entry and fsnotify.Op.
type WatchFilter ¶ added in v0.12.0
type WatchFilter interface {
// contains filtered or unexported methods
}
WatchFilter interface facilitates filtering of file events.