walkfs

package
v1.0.51 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VisitFunc

type VisitFunc func(context.Context, string, string, fs.FileInfo) error

type WalkFS

type WalkFS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(fn VisitFunc) *WalkFS

Create a new walkfs with a given visitor function, which is used for touching each visited file and folder

func (*WalkFS) Count

func (walkfs *WalkFS) Count() int

Count the number of files and folders visited

func (*WalkFS) Exclude

func (walkfs *WalkFS) Exclude(v string) error

Exclude adds a path or file extension exclusion to the indexer. If it begins with a '.' then a file extension exlusion is added, If it begins with a '/' then a path extension exclusion is added. Path and name exclusions are case-sensitive, file extension exclusions are not.

func (*WalkFS) Include

func (walkfs *WalkFS) Include(ext string) error

Include adds a file extension inclusion to the indexer. Path exclusions are case-sensitive, file extension exclusions are not. If no inclusions are added, all files are visited

func (*WalkFS) ShouldVisit

func (walkfs *WalkFS) ShouldVisit(relpath string, info fs.FileInfo) bool

ShouldVisit returns true if a path or file should be visited based on exclusions or else returns false

func (*WalkFS) Walk

func (walkfs *WalkFS) Walk(ctx context.Context, path string) error

Walk will walk a file or folder and visit the function for each

Jump to

Keyboard shortcuts

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