v2

package
v1.13.27 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCreateMode = os.O_CREATE | os.O_RDWR
	DefaultReadMode   = os.O_RDWR
)

Variables

View Source
var (
	FileInitErr          FileInitError
	FileNotExistsErr     FileNotExistsError
	FileFullPathEmptyErr FileFullPathEmptyError
	CreateFileErr        CreateFileError
	RenameFileErr        RenameFileError
	RemoveFileErr        RemoveFileError
	PermissionFileErr    PermissionFileError
	CopyFileErr          CopyFileError
	CopyFileSrcErr       CopyFileSrcError
	CopyFileDstErr       CopyFileDstError
	WriteFileErr         WriteFileError
	ReadFileErr          ReadFileError

	DirInitErr          DirInitError
	DirNotExistsErr     DirNotExistsError
	DirFullPathEmptyErr DirFullPathEmptyError
	CreateDirErr        CreateDirError
	RenameDirErr        RenameDirError
	RemoveDirErr        RemoveDirError
	PermissionDirErr    PermissionDirError
	CopyDirErr          CopyDirError
	CopyDirSrcErr       CopyDirSrcError
	CopyDirDstErr       CopyDirDstError
	WriteDirErr         WriteDirError
	ReadDirErr          ReadDirError
)

Functions

func CopyFiles added in v1.10.6

func CopyFiles(srcFiles, dstFiles *array.AnyArray[*File])

CopyFiles 批量复制文件

func CopyFilesBy2Path added in v1.10.6

func CopyFilesBy2Path(srcPath, dstPath string)

CopyFilesBy2Path 批量复制文件:通过src绝对路径到dst绝对路径(无法指定拷贝后的文件名)

func CopyFilesByDstPath added in v1.10.6

func CopyFilesByDstPath(srcFiles *array.AnyArray[*File], dstPath string)

CopyFilesByDstPath 批量复制文件:通过dst绝对路径(无法指定拷贝后的文件名)

Types

type CopyDirDstError

type CopyDirDstError struct{ myError.MyError }

func (*CopyDirDstError) Error

func (my *CopyDirDstError) Error() string

func (*CopyDirDstError) Is

func (*CopyDirDstError) Is(target error) bool

func (*CopyDirDstError) New

func (*CopyDirDstError) Panic added in v1.10.25

func (*CopyDirDstError) Panic() myError.IMyError

func (*CopyDirDstError) Wrap

type CopyDirError

type CopyDirError struct{ myError.MyError }

func (*CopyDirError) Error

func (my *CopyDirError) Error() string

func (*CopyDirError) Is

func (*CopyDirError) Is(target error) bool

func (*CopyDirError) New

func (*CopyDirError) New(msg string) myError.IMyError

func (*CopyDirError) Panic added in v1.10.25

func (*CopyDirError) Panic() myError.IMyError

func (*CopyDirError) Wrap

func (*CopyDirError) Wrap(err error) myError.IMyError

type CopyDirSrcError

type CopyDirSrcError struct{ myError.MyError }

func (*CopyDirSrcError) Error

func (my *CopyDirSrcError) Error() string

func (*CopyDirSrcError) Is

func (*CopyDirSrcError) Is(target error) bool

func (*CopyDirSrcError) New

func (*CopyDirSrcError) Panic added in v1.10.25

func (*CopyDirSrcError) Panic() myError.IMyError

func (*CopyDirSrcError) Wrap

type CopyFileDstError

type CopyFileDstError struct{ myError.MyError }

func (*CopyFileDstError) Error

func (my *CopyFileDstError) Error() string

func (*CopyFileDstError) Is

func (*CopyFileDstError) Is(target error) bool

func (*CopyFileDstError) New

func (*CopyFileDstError) Panic added in v1.10.25

func (*CopyFileDstError) Wrap

type CopyFileError

type CopyFileError struct{ myError.MyError }

func (*CopyFileError) Error

func (my *CopyFileError) Error() string

func (*CopyFileError) Is

func (*CopyFileError) Is(target error) bool

func (*CopyFileError) New

func (*CopyFileError) Panic added in v1.10.25

func (*CopyFileError) Panic() myError.IMyError

func (*CopyFileError) Wrap

func (*CopyFileError) Wrap(err error) myError.IMyError

type CopyFileSrcError

type CopyFileSrcError struct{ myError.MyError }

func (*CopyFileSrcError) Error

func (my *CopyFileSrcError) Error() string

func (*CopyFileSrcError) Is

func (*CopyFileSrcError) Is(target error) bool

func (*CopyFileSrcError) New

func (*CopyFileSrcError) Panic added in v1.10.25

func (*CopyFileSrcError) Wrap

type CreateDirError

type CreateDirError struct{ myError.MyError }

func (*CreateDirError) Error

func (my *CreateDirError) Error() string

func (*CreateDirError) Is

func (*CreateDirError) Is(target error) bool

func (*CreateDirError) New

func (*CreateDirError) Panic added in v1.10.25

func (*CreateDirError) Panic() myError.IMyError

func (*CreateDirError) Wrap

func (*CreateDirError) Wrap(err error) myError.IMyError

type CreateFileError

type CreateFileError struct{ myError.MyError }

func (*CreateFileError) Error

func (my *CreateFileError) Error() string

func (*CreateFileError) Is

func (*CreateFileError) Is(target error) bool

func (*CreateFileError) New

func (*CreateFileError) Panic added in v1.10.25

func (*CreateFileError) Panic() myError.IMyError

func (*CreateFileError) Wrap

type Dir

type Dir struct {
	// contains filtered or unexported fields
}
var DirApp Dir

func (*Dir) CheckPermission

func (my *Dir) CheckPermission(mode os.FileMode) bool

CheckPermission 检查目录权限

func (*Dir) Copy

func (my *Dir) Copy() *Dir

Copy 复制当前对象

func (*Dir) CopyAllDirsTo

func (my *Dir) CopyAllDirsTo(dstDir string) *Dir

CopyAllDirsTo 复制目录下所有文件夹及文件

func (*Dir) CopyAllFilesTo

func (my *Dir) CopyAllFilesTo(dstDir string) *Dir

CopyAllFilesTo 复制所有文件

func (*Dir) Create

func (my *Dir) Create(mode os.FileMode) *Dir

Create 新建目录

func (*Dir) CreateDefaultMode

func (my *Dir) CreateDefaultMode() *Dir

CreateDefaultMode 新建目录:默认权限

func (*Dir) Error

func (my *Dir) Error() error

Error 获取错误

func (*Dir) GetBasePath

func (my *Dir) GetBasePath() string

GetBasePath 获取基础路径

func (*Dir) GetDirs

func (my *Dir) GetDirs() *array.AnyArray[*Dir]

GetDirs 获取当前目录下所有文件夹

func (*Dir) GetExist

func (my *Dir) GetExist() bool

GetExist 获取目录是否存在

func (*Dir) GetFiles

func (my *Dir) GetFiles() *array.AnyArray[*File]

GetFiles 获取当前目录下所有文件

func (*Dir) GetFullPath

func (my *Dir) GetFullPath() string

GetFullPath 获取完整路径

func (*Dir) GetInfo

func (my *Dir) GetInfo() os.FileInfo

GetInfo 获取文件夹信息

func (*Dir) GetMode

func (my *Dir) GetMode() os.FileMode

GetMode 获取文件夹权限

func (*Dir) GetName

func (my *Dir) GetName() string

GetName 获取文件名

func (*Dir) GetSize

func (my *Dir) GetSize() int64

GetSize 获取文件夹大小

func (*Dir) Join

func (my *Dir) Join(path string) *Dir

Join 添加路径

func (*Dir) Joins

func (my *Dir) Joins(paths ...string) *Dir

Joins 添加多个路径

func (*Dir) Lock added in v1.10.2

func (my *Dir) Lock() *Dir

Lock 加锁:写锁

func (*Dir) Ls

func (my *Dir) Ls() *Dir

Ls 获取当前目录内容

func (*Dir) NewByAbs

func (*Dir) NewByAbs(path string) *Dir

NewByAbs 实例化:通过绝对路径

func (*Dir) NewByRel

func (*Dir) NewByRel(path string) *Dir

NewByRel 实例化:通过相对路径

func (*Dir) RLock added in v1.10.2

func (my *Dir) RLock() *Dir

RLock 加锁:读锁

func (*Dir) RUnlock added in v1.10.2

func (my *Dir) RUnlock() *Dir

RUnlock 解锁:读锁

func (*Dir) Remove

func (my *Dir) Remove() *Dir

Remove 删除目录

func (*Dir) Rename

func (my *Dir) Rename(newName string) *Dir

Rename 文件夹重命名

func (*Dir) Unlock added in v1.10.2

func (my *Dir) Unlock() *Dir

Unlock 解锁:写锁

func (*Dir) WhoAmI

func (*Dir) WhoAmI() FilesystemV2Type

WhoAmI 获取当前类型:(目录)

type DirCollection

type DirCollection struct {
	Dirs  []*Dir
	Files []*File
}

type DirFullPathEmptyError

type DirFullPathEmptyError struct{ myError.MyError }

func (*DirFullPathEmptyError) Error

func (my *DirFullPathEmptyError) Error() string

func (*DirFullPathEmptyError) Is

func (*DirFullPathEmptyError) Is(target error) bool

func (*DirFullPathEmptyError) New

func (*DirFullPathEmptyError) Panic added in v1.10.25

func (*DirFullPathEmptyError) Wrap

type DirInitError

type DirInitError struct{ myError.MyError }

func (*DirInitError) Error

func (my *DirInitError) Error() string

func (*DirInitError) Is

func (*DirInitError) Is(target error) bool

func (*DirInitError) New

func (*DirInitError) New(msg string) myError.IMyError

func (*DirInitError) Panic added in v1.10.25

func (*DirInitError) Panic() myError.IMyError

func (*DirInitError) Wrap

func (*DirInitError) Wrap(err error) myError.IMyError

type DirNotExistsError

type DirNotExistsError struct{ myError.MyError }

func (*DirNotExistsError) Error

func (my *DirNotExistsError) Error() string

func (*DirNotExistsError) Is

func (*DirNotExistsError) Is(target error) bool

func (*DirNotExistsError) New

func (*DirNotExistsError) Panic added in v1.10.25

func (*DirNotExistsError) Wrap

type File

type File struct {
	Mime string // 文件Mime类型
	// contains filtered or unexported fields
}
var FileApp File

func (*File) CheckPermission

func (my *File) CheckPermission(permissions ...int) *File

CheckPermission 检查文件权限

func (*File) Copy

func (my *File) Copy() *File

Copy 复制当前对象

func (*File) CopyTo

func (my *File) CopyTo(dstFilename string) *File

CopyTo 复制文件

func (*File) Create

func (my *File) Create(mode os.FileMode, operations ...int) *File

Create 创建文件

func (*File) CreateDefaultMode

func (my *File) CreateDefaultMode(operations ...int) *File

func (*File) Error

func (my *File) Error() error

Error 获取错误

func (*File) GetBasePath

func (my *File) GetBasePath() string

GetBasePath 获取基础路径

func (*File) GetExist

func (my *File) GetExist() bool

GetExist 获取文件是否存在

func (*File) GetExtension

func (my *File) GetExtension() string

GetExtension 获取文件扩展名

func (*File) GetFullPath

func (my *File) GetFullPath() string

GetFullPath 获取完整路径

func (*File) GetInfo

func (my *File) GetInfo() os.FileInfo

GetInfo 获取文件信息

func (*File) GetMode

func (my *File) GetMode() os.FileMode

GetMode 获取文件权限

func (*File) GetName

func (my *File) GetName() string

GetName 获取文件名

func (*File) GetSize

func (my *File) GetSize() int64

GetSize 获取文件大小

func (*File) Lock added in v1.10.2

func (my *File) Lock() *File

Lock 加锁:写锁

func (*File) NewByAbs

func (*File) NewByAbs(path string) *File

NewByAbs 实例化:通过绝对路径

func (*File) NewByRel

func (*File) NewByRel(path string) *File

NewByRel 实例化:通过相对路径

func (*File) RLock added in v1.10.2

func (my *File) RLock() *File

RLock 加锁:读锁

func (*File) RUnlock added in v1.10.2

func (my *File) RUnlock() *File

RUnlock 解锁:读锁

func (*File) Read

func (my *File) Read() []byte

Read 读取文件

func (*File) Remove

func (my *File) Remove() *File

Remove 删除文件

func (*File) Rename

func (my *File) Rename(newName string) *File

Rename 修改文件名

func (*File) Unlock added in v1.10.2

func (my *File) Unlock() *File

Unlock 解锁:写锁

func (*File) WhoAmI

func (*File) WhoAmI() FilesystemV2Type

WhoAmI 获取当前类型:(文件)

func (*File) Write

func (my *File) Write(content []byte, mode os.FileMode, operations ...int) *File

Write 写入文件

type FileFullPathEmptyError

type FileFullPathEmptyError struct{ myError.MyError }

func (*FileFullPathEmptyError) Error

func (my *FileFullPathEmptyError) Error() string

func (*FileFullPathEmptyError) Is

func (*FileFullPathEmptyError) Is(target error) bool

func (*FileFullPathEmptyError) New

func (*FileFullPathEmptyError) Panic added in v1.10.25

func (*FileFullPathEmptyError) Wrap

type FileInitError

type FileInitError struct{ myError.MyError }

func (*FileInitError) Error

func (my *FileInitError) Error() string

func (*FileInitError) Is

func (*FileInitError) Is(target error) bool

func (*FileInitError) New

func (*FileInitError) Panic added in v1.10.25

func (*FileInitError) Panic() myError.IMyError

func (*FileInitError) Wrap

func (*FileInitError) Wrap(err error) myError.IMyError

type FileNotExistsError

type FileNotExistsError struct{ myError.MyError }

func (*FileNotExistsError) Error

func (my *FileNotExistsError) Error() string

func (*FileNotExistsError) Is

func (*FileNotExistsError) Is(target error) bool

func (*FileNotExistsError) New

func (*FileNotExistsError) Panic added in v1.10.25

func (*FileNotExistsError) Wrap

type FilesystemV2Type

type FilesystemV2Type string
const (
	FilesystemV2File FilesystemV2Type = "FILE"
	FilesystemV2Dir  FilesystemV2Type = "DIR"
)

type IFilesystemV2

type IFilesystemV2 interface{ WhoAmI() FilesystemV2Type }

type PermissionDirError

type PermissionDirError struct{ myError.MyError }

func (*PermissionDirError) Error

func (my *PermissionDirError) Error() string

func (*PermissionDirError) Is

func (*PermissionDirError) Is(target error) bool

func (*PermissionDirError) New

func (*PermissionDirError) Panic added in v1.10.25

func (*PermissionDirError) Wrap

type PermissionFileError

type PermissionFileError struct{ myError.MyError }

func (*PermissionFileError) Error

func (my *PermissionFileError) Error() string

func (*PermissionFileError) Is

func (*PermissionFileError) Is(target error) bool

func (*PermissionFileError) New

func (*PermissionFileError) Panic added in v1.10.25

func (*PermissionFileError) Wrap

type ReadDirError

type ReadDirError struct{ myError.MyError }

func (*ReadDirError) Error

func (my *ReadDirError) Error() string

func (*ReadDirError) Is

func (*ReadDirError) Is(target error) bool

func (*ReadDirError) New

func (*ReadDirError) New(msg string) myError.IMyError

func (*ReadDirError) Panic added in v1.10.25

func (*ReadDirError) Panic() myError.IMyError

func (*ReadDirError) Wrap

func (*ReadDirError) Wrap(err error) myError.IMyError

type ReadFileError

type ReadFileError struct{ myError.MyError }

func (*ReadFileError) Error

func (my *ReadFileError) Error() string

func (*ReadFileError) Is

func (*ReadFileError) Is(target error) bool

func (*ReadFileError) New

func (*ReadFileError) Panic added in v1.10.25

func (*ReadFileError) Panic() myError.IMyError

func (*ReadFileError) Wrap

func (*ReadFileError) Wrap(err error) myError.IMyError

type RemoveDirError

type RemoveDirError struct{ myError.MyError }

func (*RemoveDirError) Error

func (my *RemoveDirError) Error() string

func (*RemoveDirError) Is

func (*RemoveDirError) Is(target error) bool

func (*RemoveDirError) New

func (*RemoveDirError) Panic added in v1.10.25

func (*RemoveDirError) Panic() myError.IMyError

func (*RemoveDirError) Wrap

func (*RemoveDirError) Wrap(err error) myError.IMyError

type RemoveFileError

type RemoveFileError struct{ myError.MyError }

func (*RemoveFileError) Error

func (my *RemoveFileError) Error() string

func (*RemoveFileError) Is

func (*RemoveFileError) Is(target error) bool

func (*RemoveFileError) New

func (*RemoveFileError) Panic added in v1.10.25

func (*RemoveFileError) Panic() myError.IMyError

func (*RemoveFileError) Wrap

type RenameDirError

type RenameDirError struct{ myError.MyError }

func (*RenameDirError) Error

func (my *RenameDirError) Error() string

func (*RenameDirError) Is

func (*RenameDirError) Is(target error) bool

func (*RenameDirError) New

func (*RenameDirError) Panic added in v1.10.25

func (*RenameDirError) Panic() myError.IMyError

func (*RenameDirError) Wrap

func (*RenameDirError) Wrap(err error) myError.IMyError

type RenameFileError

type RenameFileError struct{ myError.MyError }

func (*RenameFileError) Error

func (my *RenameFileError) Error() string

func (*RenameFileError) Is

func (*RenameFileError) Is(target error) bool

func (*RenameFileError) New

func (*RenameFileError) Panic added in v1.10.25

func (*RenameFileError) Panic() myError.IMyError

func (*RenameFileError) Wrap

type WriteDirError

type WriteDirError struct{ myError.MyError }

func (*WriteDirError) Error

func (my *WriteDirError) Error() string

func (*WriteDirError) Is

func (*WriteDirError) Is(target error) bool

func (*WriteDirError) New

func (*WriteDirError) Panic added in v1.10.25

func (*WriteDirError) Panic() myError.IMyError

func (*WriteDirError) Wrap

func (*WriteDirError) Wrap(err error) myError.IMyError

type WriteFileError

type WriteFileError struct{ myError.MyError }

func (*WriteFileError) Error

func (my *WriteFileError) Error() string

func (*WriteFileError) Is

func (*WriteFileError) Is(target error) bool

func (*WriteFileError) New

func (*WriteFileError) Panic added in v1.10.25

func (*WriteFileError) Panic() myError.IMyError

func (*WriteFileError) Wrap

func (*WriteFileError) Wrap(err error) myError.IMyError

Jump to

Keyboard shortcuts

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