walk

package
v1.35.0-aplha Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action func(path string, info Dirent) error

Action is a function that takes a file's path and information, and optionally returns an error.

type Builder

type Builder interface {
	// Options
	Unsorted() Builder

	// Predicates
	When(Predicate) Builder
	WhenIsDir() Builder
	WhenIsFile() Builder
	WhenHasName(string) Builder
	WhenNameMatches(string) Builder

	// Actions
	Do(Action) error
	MustDo(Action)
	AppendPaths(*[]string) error
	CollectPaths() ([]string, error)
	CollectPathsGrouped(depth int) (map[string][]string, error)
}

func From

func From(dir string) Builder

type Dirent

type Dirent interface {
	IsDir() bool
	Name() string
}

Dirent stores the name and type of a file system entry.

type Predicate

type Predicate func(path string, info Dirent) (bool, error)

Predicate represents a predicate on file system entries. Given a file's path and information, it returns `true` when the predicate is matched. It can also return a `filepath.SkipDir` error to skip a directory and its children altogether.

Jump to

Keyboard shortcuts

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