filex

package
v0.0.0-...-4da1013 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	os.FileInfo
	// contains filtered or unexported fields
}

func MustFileInfo

func MustFileInfo(path string) (obj *FileInfo)

MustFileInfo 必须获得FileInfo,否则异常

func NewFileInfo

func NewFileInfo(path string) (obj *FileInfo, err error)

NewFileInfo 新建一个FileInfo

func (*FileInfo) Children

func (i *FileInfo) Children() (children []IFileInfo)

func (*FileInfo) Depth

func (i *FileInfo) Depth() int

func (*FileInfo) Path

func (i *FileInfo) Path() string

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter() (obj *Filter)

func (*Filter) Depth

func (f *Filter) Depth(val int) *Filter

深度

func (*Filter) ExcludeAllDir

func (f *Filter) ExcludeAllDir() *Filter

func (*Filter) GetFileInfosByDir

func (f *Filter) GetFileInfosByDir(dir *FileInfo) []IFileInfo

func (*Filter) GetFileInfosByPath

func (f *Filter) GetFileInfosByPath(path string) []IFileInfo

func (*Filter) IgnoreDir

func (f *Filter) IgnoreDir(dir string) *Filter

忽略掉[ignoreDirs]指定的目录, 例如.git/.svn, 避免递归遍历

func (*Filter) IncludeSuffix

func (f *Filter) IncludeSuffix(val ...string) *Filter

指定后缀[.suffix, ...]

func (*Filter) MatchName

func (f *Filter) MatchName(regexp *regexp.Regexp) *Filter

指定后缀[.suffix, ...]

func (*Filter) Recursive

func (f *Filter) Recursive() *Filter

递归

func (*Filter) Validator

func (f *Filter) Validator(v func(ifile IFileInfo) bool) *Filter

验证器

type IFileInfo

type IFileInfo interface {
	os.FileInfo

	Path() string

	// Depth 使用过滤器后产生的相对于过滤器根目录的深度
	Depth() int
	// contains filtered or unexported methods
}

IFileInfo os.FileInfo的扩展

Jump to

Keyboard shortcuts

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