Documentation
¶
Index ¶
- Variables
- type AttrFlag
- type AttrMode
- type AttrPath
- type Dir
- func (my *Dir) Copy() IFilesystem
- func (my *Dir) CopyDirsTo(isRel bool, dstPaths ...string) *Dir
- func (my *Dir) CopyFilesTo(isRel bool, dstPaths ...string) *Dir
- func (my *Dir) CopyTo(isRel bool, dstPaths ...string) IFilesystem
- func (my *Dir) Create(attrs ...OperationAttributer) IFilesystem
- func (my *Dir) GetBasePath() string
- func (my *Dir) GetDirs() []IFilesystem
- func (my *Dir) GetError() error
- func (my *Dir) GetExist() bool
- func (my *Dir) GetFiles() []IFilesystem
- func (my *Dir) GetFullPath() string
- func (my *Dir) GetInfo() os.FileInfo
- func (my *Dir) GetKind() string
- func (my *Dir) GetName() string
- func (my *Dir) Join(paths ...string) IFilesystem
- func (my *Dir) LS() IFilesystem
- func (my *Dir) Lock() IFilesystem
- func (my *Dir) RLock() IFilesystem
- func (my *Dir) RUnlock() IFilesystem
- func (my *Dir) Read(attrs ...OperationAttributer) ([]byte, error)
- func (my *Dir) Remove() IFilesystem
- func (my *Dir) RemoveAll() IFilesystem
- func (my *Dir) Rename(newName string) IFilesystem
- func (my *Dir) SetAttrs(attrs ...PathAttributer) IFilesystem
- func (my *Dir) SetFullPathByAttr(attrs ...PathAttributer) IFilesystem
- func (my *Dir) SetFullPathForAttr(path string) IFilesystem
- func (my *Dir) Unlock() IFilesystem
- func (my *Dir) Up() IFilesystem
- func (my *Dir) Write(content []byte, attrs ...OperationAttributer) IFilesystem
- func (my *Dir) Zip() IFilesystem
- type File
- func (my *File) Copy() IFilesystem
- func (my *File) CopyTo(isRel bool, dstPaths ...string) IFilesystem
- func (my *File) Create(attrs ...OperationAttributer) IFilesystem
- func (my *File) GetBasePath() string
- func (my *File) GetDirs() []IFilesystem
- func (my *File) GetError() error
- func (my *File) GetExist() bool
- func (my *File) GetFiles() []IFilesystem
- func (my *File) GetFullPath() string
- func (my *File) GetInfo() os.FileInfo
- func (my *File) GetKind() string
- func (my *File) GetName() string
- func (my *File) Join(paths ...string) IFilesystem
- func (my *File) LS() IFilesystem
- func (my *File) Lock() IFilesystem
- func (my *File) RLock() IFilesystem
- func (my *File) RUnlock() IFilesystem
- func (my *File) Read(attrs ...OperationAttributer) ([]byte, error)
- func (my *File) Remove() IFilesystem
- func (my *File) RemoveAll() IFilesystem
- func (my *File) Rename(newName string) IFilesystem
- func (my *File) SetAttrs(attrs ...PathAttributer) IFilesystem
- func (my *File) SetFullPathByAttr(attrs ...PathAttributer) IFilesystem
- func (my *File) SetFullPathForAttr(path string) IFilesystem
- func (my *File) Unlock() IFilesystem
- func (my *File) Up() IFilesystem
- func (my *File) Write(content []byte, attrs ...OperationAttributer) IFilesystem
- func (my *File) Zip() IFilesystem
- type IFilesystem
- type Operation
- type OperationAttributer
- type PathAttributer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInit = fmt.Errorf("获取文件或目录信息失败") ErrMissFullPath = fmt.Errorf("文件或目录完整路径不能为空") ErrRename = fmt.Errorf("修改文件名失败") ErrRemove = fmt.Errorf("删除文件失败") ErrFileNotExist = fmt.Errorf("文件不存在") ErrCreateFile = fmt.Errorf("创建文件失败") ErrWriteFile = fmt.Errorf("写入文件失败") ErrReadFile = fmt.Errorf("读取文件失败") ErrOpenFile = fmt.Errorf("打开文件失败") ErrDirNotExist = fmt.Errorf("目录不存在") ErrCreateDir = fmt.Errorf("创建目录失败") ErrReadDir = fmt.Errorf("读取目录失败") )
Functions ¶
This section is empty.
Types ¶
type AttrPath ¶ added in v1.61.0
type AttrPath struct {
// contains filtered or unexported fields
}
func (AttrPath) Joins ¶ added in v1.64.4
func (my AttrPath) Joins(paths ...string) PathAttributer
func (AttrPath) Register ¶ added in v1.61.0
func (my AttrPath) Register(f IFilesystem)
type Dir ¶
type Dir struct {
Error error `json:"error" swaggertype:"string"` // 错误信息
Name string `json:"name" swaggertype:"string"` // 文件名
BasePath string `json:"basePath" swaggertype:"string"` // 基础路径
FullPath string `json:"fullPath" swaggertype:"string"` // 完整路径
Size int64 `json:"size" swaggertype:"integer"` // 文件大小
Info os.FileInfo `json:"info" swaggertype:"string"` // 文件信息
Mode os.FileMode `json:"mode" swaggertype:"string"` // 文件权限
Exist bool `json:"exist" swaggertype:"boolean"` // 文件是否存在
Files []IFilesystem `json:"files" swaggertype:"array,object"` // 目录下的文件列表
Dirs []IFilesystem `json:"dirs" swaggertype:"array,object"` // 子目录列表
Kind string `json:"kind" swaggertype:"string"` // 类型
// contains filtered or unexported fields
}
func (*Dir) CopyDirsTo ¶
CopyTo 复制当前目录下的所有子目录到目标路径
func (*Dir) CopyFilesTo ¶
CopyFilesTo 复制当前目录下的所有文件到目标路径
func (*Dir) CopyTo ¶ added in v1.61.0
func (my *Dir) CopyTo(isRel bool, dstPaths ...string) IFilesystem
CopyAllTo 复制当前目录下的所有文件和子目录到目标路径
func (*Dir) GetBasePath ¶ added in v1.64.46
func (*Dir) GetDirs ¶ added in v1.61.1
func (my *Dir) GetDirs() []IFilesystem
func (*Dir) GetFiles ¶ added in v1.61.1
func (my *Dir) GetFiles() []IFilesystem
func (*Dir) GetFullPath ¶ added in v1.61.0
func (*Dir) Join ¶
func (my *Dir) Join(paths ...string) IFilesystem
func (*Dir) Read ¶ added in v1.64.6
func (my *Dir) Read(attrs ...OperationAttributer) ([]byte, error)
func (*Dir) SetAttrs ¶ added in v1.61.0
func (my *Dir) SetAttrs(attrs ...PathAttributer) IFilesystem
func (*Dir) SetFullPathByAttr ¶ added in v1.61.0
func (my *Dir) SetFullPathByAttr(attrs ...PathAttributer) IFilesystem
func (*Dir) SetFullPathForAttr ¶ added in v1.61.0
func (my *Dir) SetFullPathForAttr(path string) IFilesystem
func (*Dir) Write ¶ added in v1.64.2
func (my *Dir) Write(content []byte, attrs ...OperationAttributer) IFilesystem
type File ¶
type File struct {
Error error `json:"error" swaggertype:"string"` // 错误信息
Name string `json:"name" swaggertype:"string"` // 文件名
BasePath string `json:"basePath" swaggertype:"string"` // 基础路径
FullPath string `json:"fullPath" swaggertype:"string"` // 完整路径
Size int64 `json:"size" swaggertype:"integer"` // 文件大小
Info os.FileInfo `json:"info" swaggertype:"string"` // 文件信息
Mode os.FileMode `json:"mode" swaggertype:"string"` // 文件权限
Exist bool `json:"exist" swaggertype:"boolean"` // 文件是否存在
Ext string `json:"extension" swaggertype:"string"` // 文件扩展名
Mime string `json:"mime" swaggertype:"string"` // 文件 Mime 类型
Kind string `json:"kind" swaggertype:"string"` // 类型
// contains filtered or unexported fields
}
func (*File) Copy ¶
func (my *File) Copy() IFilesystem
func (*File) CopyTo ¶
func (my *File) CopyTo(isRel bool, dstPaths ...string) IFilesystem
CopyTo 复制文件到指定路径
func (*File) GetBasePath ¶ added in v1.64.46
func (*File) GetDirs ¶ added in v1.61.1
func (my *File) GetDirs() []IFilesystem
func (*File) GetFiles ¶ added in v1.61.1
func (my *File) GetFiles() []IFilesystem
func (*File) GetFullPath ¶ added in v1.61.0
func (*File) Join ¶
func (my *File) Join(paths ...string) IFilesystem
func (*File) LS ¶ added in v1.61.1
func (my *File) LS() IFilesystem
func (*File) RemoveAll ¶ added in v1.64.6
func (my *File) RemoveAll() IFilesystem
func (*File) SetAttrs ¶ added in v1.61.0
func (my *File) SetAttrs(attrs ...PathAttributer) IFilesystem
func (*File) SetFullPathByAttr ¶ added in v1.61.0
func (my *File) SetFullPathByAttr(attrs ...PathAttributer) IFilesystem
func (*File) SetFullPathForAttr ¶ added in v1.61.0
func (my *File) SetFullPathForAttr(path string) IFilesystem
func (*File) Up ¶ added in v1.61.0
func (my *File) Up() IFilesystem
func (*File) Write ¶
func (my *File) Write(content []byte, attrs ...OperationAttributer) IFilesystem
向文件内写入内容
type IFilesystem ¶ added in v1.66.1
type IFilesystem interface {
GetName() string
GetExist() bool
GetError() error
GetBasePath() string
GetFullPath() string
GetInfo() os.FileInfo
GetDirs() []IFilesystem
GetFiles() []IFilesystem
GetKind() string
SetAttrs(attrs ...PathAttributer) IFilesystem
SetFullPathForAttr(path string) IFilesystem
SetFullPathByAttr(attrs ...PathAttributer) IFilesystem
Lock() IFilesystem
Unlock() IFilesystem
RLock() IFilesystem
RUnlock() IFilesystem
Join(paths ...string) IFilesystem
Create(attrs ...OperationAttributer) IFilesystem
Rename(newName string) IFilesystem
Remove() IFilesystem
RemoveAll() IFilesystem
Write(content []byte, attrs ...OperationAttributer) IFilesystem
Read(attrs ...OperationAttributer) ([]byte, error)
CopyTo(isRel bool, dstPaths ...string) IFilesystem
Copy() IFilesystem
Up() IFilesystem
LS() IFilesystem
Zip() IFilesystem
// contains filtered or unexported methods
}
func New ¶ added in v1.64.63
func New(attr PathAttributer) (IFilesystem, error)
func NewDir ¶ added in v1.61.0
func NewDir(attrs ...PathAttributer) IFilesystem
func NewFile ¶ added in v1.61.0
func NewFile(attrs ...PathAttributer) IFilesystem
type Operation ¶ added in v1.61.0
func NewOperation ¶ added in v1.61.0
func NewOperation(attrs ...OperationAttributer) *Operation
func (*Operation) SetAttrs ¶ added in v1.61.0
func (my *Operation) SetAttrs(attrs ...OperationAttributer) *Operation
type OperationAttributer ¶ added in v1.61.0
type OperationAttributer interface{ Register(o *Operation) }
func Flag ¶ added in v1.61.0
func Flag(flag int) OperationAttributer
func Mode ¶ added in v1.61.0
func Mode(mode os.FileMode) OperationAttributer
type PathAttributer ¶ added in v1.61.0
type PathAttributer interface {
Joins(paths ...string) PathAttributer
Register(f IFilesystem)
GetPath() string
}
func Abs ¶ added in v1.61.0
func Abs(paths ...string) PathAttributer
func Rel ¶ added in v1.61.0
func Rel(paths ...string) PathAttributer
Click to show internal directories.
Click to hide internal directories.