Documentation
¶
Index ¶
- Variables
- type AttrFlag
- type AttrMode
- type AttrPath
- type Dir
- func (my *Dir) Copy() Filesystem
- 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) Filesystem
- func (my *Dir) Create(attrs ...OperationAttributer) Filesystem
- func (my *Dir) GetBasePath() string
- func (my *Dir) GetDirs() []Filesystem
- func (my *Dir) GetError() error
- func (my *Dir) GetExist() bool
- func (my *Dir) GetFiles() []Filesystem
- 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) Filesystem
- func (my *Dir) LS() Filesystem
- func (my *Dir) Lock() Filesystem
- func (my *Dir) RLock() Filesystem
- func (my *Dir) RUnlock() Filesystem
- func (my *Dir) Read(attrs ...OperationAttributer) ([]byte, error)
- func (my *Dir) Remove() Filesystem
- func (my *Dir) RemoveAll() Filesystem
- func (my *Dir) Rename(newName string) Filesystem
- func (my *Dir) SetAttrs(attrs ...PathAttributer) Filesystem
- func (my *Dir) SetFullPathByAttr(attrs ...PathAttributer) Filesystem
- func (my *Dir) SetFullPathForAttr(path string) Filesystem
- func (my *Dir) Unlock() Filesystem
- func (my *Dir) Up() Filesystem
- func (my *Dir) Write(content []byte, attrs ...OperationAttributer) Filesystem
- func (my *Dir) Zip() Filesystem
- type File
- func (my *File) Copy() Filesystem
- func (my *File) CopyTo(isRel bool, dstPaths ...string) Filesystem
- func (my *File) Create(attrs ...OperationAttributer) Filesystem
- func (my *File) GetBasePath() string
- func (my *File) GetDirs() []Filesystem
- func (my *File) GetError() error
- func (my *File) GetExist() bool
- func (my *File) GetFiles() []Filesystem
- 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) Filesystem
- func (my *File) LS() Filesystem
- func (my *File) Lock() Filesystem
- func (my *File) RLock() Filesystem
- func (my *File) RUnlock() Filesystem
- func (my *File) Read(attrs ...OperationAttributer) ([]byte, error)
- func (my *File) Remove() Filesystem
- func (my *File) RemoveAll() Filesystem
- func (my *File) Rename(newName string) Filesystem
- func (my *File) SetAttrs(attrs ...PathAttributer) Filesystem
- func (my *File) SetFullPathByAttr(attrs ...PathAttributer) Filesystem
- func (my *File) SetFullPathForAttr(path string) Filesystem
- func (my *File) Unlock() Filesystem
- func (my *File) Up() Filesystem
- func (my *File) Write(content []byte, attrs ...OperationAttributer) Filesystem
- func (my *File) Zip() Filesystem
- type Filesystem
- 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 ¶
type AttrPath struct {
// contains filtered or unexported fields
}
func (AttrPath) Joins ¶
func (my AttrPath) Joins(paths ...string) PathAttributer
func (AttrPath) Register ¶
func (my AttrPath) Register(f Filesystem)
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 []Filesystem `json:"files" swaggertype:"array,object"` // 目录下的文件列表
Dirs []Filesystem `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 ¶
func (my *Dir) CopyTo(isRel bool, dstPaths ...string) Filesystem
CopyAllTo 复制当前目录下的所有文件和子目录到目标路径
func (*Dir) GetBasePath ¶
func (*Dir) GetDirs ¶
func (my *Dir) GetDirs() []Filesystem
func (*Dir) GetFiles ¶
func (my *Dir) GetFiles() []Filesystem
func (*Dir) GetFullPath ¶
func (*Dir) Join ¶
func (my *Dir) Join(paths ...string) Filesystem
func (*Dir) SetAttrs ¶
func (my *Dir) SetAttrs(attrs ...PathAttributer) Filesystem
func (*Dir) SetFullPathByAttr ¶
func (my *Dir) SetFullPathByAttr(attrs ...PathAttributer) Filesystem
func (*Dir) SetFullPathForAttr ¶
func (my *Dir) SetFullPathForAttr(path string) Filesystem
func (*Dir) Write ¶
func (my *Dir) Write(content []byte, attrs ...OperationAttributer) Filesystem
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() Filesystem
func (*File) CopyTo ¶
func (my *File) CopyTo(isRel bool, dstPaths ...string) Filesystem
CopyTo 复制文件到指定路径
func (*File) GetBasePath ¶
func (*File) GetDirs ¶
func (my *File) GetDirs() []Filesystem
func (*File) GetFiles ¶
func (my *File) GetFiles() []Filesystem
func (*File) GetFullPath ¶
func (*File) Join ¶
func (my *File) Join(paths ...string) Filesystem
func (*File) LS ¶
func (my *File) LS() Filesystem
func (*File) RemoveAll ¶
func (my *File) RemoveAll() Filesystem
func (*File) SetAttrs ¶
func (my *File) SetAttrs(attrs ...PathAttributer) Filesystem
func (*File) SetFullPathByAttr ¶
func (my *File) SetFullPathByAttr(attrs ...PathAttributer) Filesystem
func (*File) SetFullPathForAttr ¶
func (my *File) SetFullPathForAttr(path string) Filesystem
func (*File) Up ¶
func (my *File) Up() Filesystem
func (*File) Write ¶
func (my *File) Write(content []byte, attrs ...OperationAttributer) Filesystem
向文件内写入内容
type Filesystem ¶
type Filesystem interface {
GetName() string
GetExist() bool
GetError() error
GetBasePath() string
GetFullPath() string
GetInfo() os.FileInfo
GetDirs() []Filesystem
GetFiles() []Filesystem
GetKind() string
SetAttrs(attrs ...PathAttributer) Filesystem
SetFullPathForAttr(path string) Filesystem
SetFullPathByAttr(attrs ...PathAttributer) Filesystem
Lock() Filesystem
Unlock() Filesystem
RLock() Filesystem
RUnlock() Filesystem
Join(paths ...string) Filesystem
Create(attrs ...OperationAttributer) Filesystem
Rename(newName string) Filesystem
Remove() Filesystem
RemoveAll() Filesystem
Write(content []byte, attrs ...OperationAttributer) Filesystem
Read(attrs ...OperationAttributer) ([]byte, error)
CopyTo(isRel bool, dstPaths ...string) Filesystem
Copy() Filesystem
Up() Filesystem
LS() Filesystem
Zip() Filesystem
// contains filtered or unexported methods
}
func New ¶
func New(attr PathAttributer) (Filesystem, error)
func NewDir ¶
func NewDir(attrs ...PathAttributer) Filesystem
func NewFile ¶
func NewFile(attrs ...PathAttributer) Filesystem
type Operation ¶
func NewOperation ¶
func NewOperation(attrs ...OperationAttributer) *Operation
func (*Operation) SetAttrs ¶
func (my *Operation) SetAttrs(attrs ...OperationAttributer) *Operation
type OperationAttributer ¶
type OperationAttributer interface{ Register(o *Operation) }
func Flag ¶
func Flag(flag int) OperationAttributer
func Mode ¶
func Mode(mode os.FileMode) OperationAttributer
type PathAttributer ¶
type PathAttributer interface {
Joins(paths ...string) PathAttributer
Register(f Filesystem)
GetPath() string
}
func Abs ¶
func Abs(paths ...string) PathAttributer
func Auto ¶
func Auto(paths ...string) PathAttributer
func Rel ¶
func Rel(paths ...string) PathAttributer
Click to show internal directories.
Click to hide internal directories.