traverse

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemAddStat = iota
	ItemOverStat
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirTraverse

type DirTraverse struct {
	Path string

	Over      chan struct{}
	WorkSheet *WorkSheet

	Fc func(item *TraverseItem)
	// contains filtered or unexported fields
}

func NewDirTraverse

func NewDirTraverse(p string, fc func(item *TraverseItem), opts ...Option) *DirTraverse

func (*DirTraverse) GetAllPath

func (t *DirTraverse) GetAllPath(opts ...Option) []string

func (*DirTraverse) Handle

func (t *DirTraverse) Handle(opts ...Option)

func (*DirTraverse) SetOption

func (t *DirTraverse) SetOption(opts ...Option)

func (*DirTraverse) WaitOver

func (t *DirTraverse) WaitOver()

type FileCountRes

type FileCountRes struct {
	Count       int
	TargetCount int
	CountMap    map[string]int
	// contains filtered or unexported fields
}

func GetFileCount

func GetFileCount(dir string, opts ...Option) *FileCountRes

type FileListRes

type FileListRes struct {
	List []string
	Map  map[string]struct{}
	// contains filtered or unexported fields
}

func GetFileList

func GetFileList(dir string, opts ...Option) *FileListRes

type Option

type Option func(o *option)

func WithDefaultExclude

func WithDefaultExclude() Option

func WithDepth

func WithDepth(depth int) Option

func WithExcludeDir

func WithExcludeDir(exclude []string) Option

func WithExcludePrefix

func WithExcludePrefix(list ...string) Option

func WithExcludeSuffix

func WithExcludeSuffix(list ...string) Option

func WithExcludeUnknown

func WithExcludeUnknown(exclude bool) Option

func WithOnlyDir

func WithOnlyDir() Option

func WithProgressBarOut

func WithProgressBarOut() Option

func WithSyncFileOpMode

func WithSyncFileOpMode() Option

func WithSyncMode

func WithSyncMode() Option

func WithTargetExt

func WithTargetExt(ext string) Option

func WithWorkerCount

func WithWorkerCount(count int) Option

type Sheet

type Sheet map[string]bool

the map[string]bool, "" item is self the name like path,name must unique

type TraverseItem

type TraverseItem struct {
	Fs       fs.FileInfo
	IsDir    bool
	FilePath string
	Path     string
	Parent   string
	Ext      string
	Depth    int
}

type WorkSheet

type WorkSheet struct {
	Sheet Sheet
	Over  bool

	WithProgressBarOut bool

	Count     int64
	OverCount int64
	// contains filtered or unexported fields
}

func NewWorkSheet

func NewWorkSheet() *WorkSheet

func (*WorkSheet) IsOver

func (w *WorkSheet) IsOver() bool

func (*WorkSheet) ItemAdd

func (w *WorkSheet) ItemAdd(path string)

func (*WorkSheet) ItemOver

func (w *WorkSheet) ItemOver(path string)

func (*WorkSheet) TraverseOver

func (w *WorkSheet) TraverseOver()

func (*WorkSheet) Wait

func (w *WorkSheet) Wait()

Jump to

Keyboard shortcuts

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