fllesystem

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(adapters interfaces.Adapter, conf ...map[string]interface{}) interfaces.Fllesystem

new 文件管理器

Types

type Directory

type Directory struct {
	Handler
}

*

  • 文件管理器文件夹操作扩展 *
  • @create 2021-8-1
  • @author deatil

func NewDirectory

func NewDirectory(filesystem interfaces.Fllesystem, path ...string) *Directory

new 文件管理器

func (*Directory) Delete

func (dir *Directory) Delete() bool

删除文件夹

func (*Directory) GetContents

func (dir *Directory) GetContents(recursive ...bool) []map[string]interface{}

列出文件

func (*Directory) SetFilesystem

func (dir *Directory) SetFilesystem(filesystem interfaces.Fllesystem) *Directory

设置管理器

func (*Directory) SetPath

func (dir *Directory) SetPath(path string) *Directory

设置目录

type File

type File struct {
	Handler
}

*

  • 文件管理扩展 *
  • @create 2021-8-1
  • @author deatil

func NewFile

func NewFile(filesystem interfaces.Fllesystem, path ...string) *File

new 文件管理器

func (*File) Copy

func (file *File) Copy(newpath string) (*File, bool)

复制

func (*File) Delete

func (file *File) Delete() bool

删除

func (*File) Exists

func (file *File) Exists() bool

存在

func (*File) GetMetadata

func (file *File) GetMetadata() map[string]interface{}

数据

func (*File) GetMimetype

func (file *File) GetMimetype() string

文件类型

func (*File) GetSize

func (file *File) GetSize() int64

大小

func (*File) GetTimestamp

func (file *File) GetTimestamp() int64

时间戳

func (*File) GetVisibility

func (file *File) GetVisibility() string

权限

func (*File) Put

func (file *File) Put(content string) bool

导入字符

func (*File) PutStream

func (file *File) PutStream(resource *os.File) bool

导入文件流

func (*File) Read

func (file *File) Read() interface{}

读取

func (*File) ReadStream

func (file *File) ReadStream() *os.File

读取成文件流

func (*File) Rename

func (file *File) Rename(newpath string) bool

重命名

func (*File) SetFilesystem

func (file *File) SetFilesystem(filesystem interfaces.Fllesystem) *File

设置管理器

func (*File) SetPath

func (file *File) SetPath(path string) *File

设置目录

func (*File) Update

func (file *File) Update(content string) bool

更新字符

func (*File) UpdateStream

func (file *File) UpdateStream(resource *os.File) bool

更新文件流

func (*File) Write

func (file *File) Write(content string) bool

写入字符

func (*File) WriteStream

func (file *File) WriteStream(resource *os.File) bool

写入文件流

type Fllesystem

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

*

  • 文件管理器 *
  • @create 2021-8-1
  • @author deatil

func (*Fllesystem) Copy

func (fs *Fllesystem) Copy(path string, newpath string) bool

复制

func (*Fllesystem) CreateDir

func (fs *Fllesystem) CreateDir(dirname string, conf ...map[string]interface{}) bool

创建文件夹

func (*Fllesystem) Delete

func (fs *Fllesystem) Delete(path string) bool

删除

func (*Fllesystem) DeleteDir

func (fs *Fllesystem) DeleteDir(dirname string) bool

删除文件夹

func (*Fllesystem) Get

func (fs *Fllesystem) Get(path string, handler ...func(interfaces.Fllesystem, string) interface{}) interface{}

获取 Get("file.txt").(*fllesystem.File).Read() Get("/file").(*fllesystem.Directory).Read()

func (*Fllesystem) GetAdapter

func (fs *Fllesystem) GetAdapter() interfaces.Adapter

获取适配器

func (*Fllesystem) GetConfig

func (fs *Fllesystem) GetConfig() interfaces.Config

获取配置

func (*Fllesystem) GetFllesystem

func (fs *Fllesystem) GetFllesystem() interfaces.Fllesystem

获取文件系统

func (*Fllesystem) GetMetadata

func (fs *Fllesystem) GetMetadata(path string) map[string]interface{}

信息数据

func (*Fllesystem) GetMimetype

func (fs *Fllesystem) GetMimetype(path string) string

类型

func (*Fllesystem) GetSize

func (fs *Fllesystem) GetSize(path string) int64

大小

func (*Fllesystem) GetTimestamp

func (fs *Fllesystem) GetTimestamp(path string) int64

时间戳

func (*Fllesystem) GetVisibility

func (fs *Fllesystem) GetVisibility(path string) string

权限

func (*Fllesystem) Has

func (fs *Fllesystem) Has(path string) bool

判断

func (*Fllesystem) ListContents

func (fs *Fllesystem) ListContents(dirname string, recursive ...bool) []map[string]interface{}

列表

func (*Fllesystem) PrepareConfig

func (fs *Fllesystem) PrepareConfig(settings map[string]interface{}) interfaces.Config

提前设置配置

func (*Fllesystem) Put

func (fs *Fllesystem) Put(path string, contents string, conf ...map[string]interface{}) bool

更新

func (*Fllesystem) PutStream

func (fs *Fllesystem) PutStream(path string, resource *os.File, conf ...map[string]interface{}) bool

更新数据流

func (*Fllesystem) Read

func (fs *Fllesystem) Read(path string) interface{}

文件到字符

func (*Fllesystem) ReadAndDelete

func (fs *Fllesystem) ReadAndDelete(path string) (interface{}, error)

读取并删除

func (*Fllesystem) ReadStream

func (fs *Fllesystem) ReadStream(path string) *os.File

读取成数据流

func (*Fllesystem) Rename

func (fs *Fllesystem) Rename(path string, newpath string) bool

重命名

func (*Fllesystem) SetConfig

func (fs *Fllesystem) SetConfig(conf interfaces.Config)

设置配置

func (*Fllesystem) SetVisibility

func (fs *Fllesystem) SetVisibility(path string, visibility string) bool

设置权限

func (*Fllesystem) Update

func (fs *Fllesystem) Update(path string, contents string, conf ...map[string]interface{}) bool

更新字符

func (*Fllesystem) UpdateStream

func (fs *Fllesystem) UpdateStream(path string, resource *os.File, conf ...map[string]interface{}) bool

更新数据流

func (*Fllesystem) WithAdapter

func (fs *Fllesystem) WithAdapter(adapters interfaces.Adapter) interfaces.Fllesystem

设置适配器

func (*Fllesystem) Write

func (fs *Fllesystem) Write(path string, contents string, conf ...map[string]interface{}) bool

写入文件

func (*Fllesystem) WriteStream

func (fs *Fllesystem) WriteStream(path string, resource *os.File, conf ...map[string]interface{}) bool

写入数据流

type Handler

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

*

  • 扩展基础类 *
  • @create 2021-8-1
  • @author deatil

func (*Handler) GetFilesystem

func (hand *Handler) GetFilesystem() interfaces.Fllesystem

获取文件系统

func (*Handler) GetPath

func (hand *Handler) GetPath() string

获取目录

func (*Handler) GetType

func (hand *Handler) GetType() string

类型

func (*Handler) IsDir

func (hand *Handler) IsDir() bool

是否为文件夹

func (*Handler) IsFile

func (hand *Handler) IsFile() bool

是否为文件

func (*Handler) SetFilesystem

func (hand *Handler) SetFilesystem(filesystem interfaces.Fllesystem) interface{}

设置文件系统

func (*Handler) SetPath

func (hand *Handler) SetPath(path string) interface{}

设置目录

type MountManager

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

*

  • 文件系统 *
  • @create 2021-8-7
  • @author deatil

func NewMountManager

func NewMountManager(filesystems ...map[string]interface{}) *MountManager

文件系统实例化

func (*MountManager) Copy

func (mm *MountManager) Copy(from string, to string, conf ...map[string]interface{}) bool

复制

func (*MountManager) CreateDir

func (mm *MountManager) CreateDir(dirname string, conf ...map[string]interface{}) bool

创建文件夹

func (*MountManager) Delete

func (mm *MountManager) Delete(path string) bool

删除

func (*MountManager) DeleteDir

func (mm *MountManager) DeleteDir(dirname string) bool

删除文件夹

func (*MountManager) FilterPrefix

func (mm *MountManager) FilterPrefix(arguments []string) (string, []string)

过滤 [:prefix, :arguments]

func (*MountManager) Get

func (mm *MountManager) Get(path string, handler ...func(interfaces.Fllesystem, string) interface{}) interface{}

获取 Get("file.txt").(*fllesystem.File).Read() Get("/file").(*fllesystem.Directory).Read()

func (*MountManager) GetFilesystem

func (mm *MountManager) GetFilesystem(prefix string) interfaces.Fllesystem

获取文件管理器

func (*MountManager) GetMetadata

func (mm *MountManager) GetMetadata(path string) map[string]interface{}

信息数据

func (*MountManager) GetMimetype

func (mm *MountManager) GetMimetype(path string) string

类型

func (*MountManager) GetPrefixAndPath

func (mm *MountManager) GetPrefixAndPath(path string) (string, string)

获取前缀和路径 [:prefix, :path]

func (*MountManager) GetSize

func (mm *MountManager) GetSize(path string) int64

大小

func (*MountManager) GetTimestamp

func (mm *MountManager) GetTimestamp(path string) int64

时间戳

func (*MountManager) GetVisibility

func (mm *MountManager) GetVisibility(path string) string

权限

func (*MountManager) Has

func (mm *MountManager) Has(path string) bool

判断

func (*MountManager) ListContents

func (mm *MountManager) ListContents(directory string, recursive ...bool) []map[string]interface{}

列出内容

func (*MountManager) MountFilesystem

func (mm *MountManager) MountFilesystem(prefix string, filesystem interfaces.Fllesystem) *MountManager

单独

func (*MountManager) MountFilesystems

func (mm *MountManager) MountFilesystems(filesystems map[string]interface{}) *MountManager

批量

func (*MountManager) Move

func (mm *MountManager) Move(from string, to string, conf ...map[string]interface{}) bool

移动

func (*MountManager) Put

func (mm *MountManager) Put(path string, contents string, conf ...map[string]interface{}) bool

更新

func (*MountManager) PutStream

func (mm *MountManager) PutStream(path string, resource *os.File, conf ...map[string]interface{}) bool

更新数据流

func (*MountManager) Read

func (mm *MountManager) Read(path string) interface{}

文件到字符

func (*MountManager) ReadAndDelete

func (mm *MountManager) ReadAndDelete(path string) (interface{}, error)

读取并删除

func (*MountManager) ReadStream

func (mm *MountManager) ReadStream(path string) *os.File

读取成数据流

func (*MountManager) Rename

func (mm *MountManager) Rename(path string, newpath string) bool

重命名

func (*MountManager) SetVisibility

func (mm *MountManager) SetVisibility(path string, visibility string) bool

设置权限

func (*MountManager) Update

func (mm *MountManager) Update(path string, contents string, conf ...map[string]interface{}) bool

更新字符

func (*MountManager) UpdateStream

func (mm *MountManager) UpdateStream(path string, resource *os.File, conf ...map[string]interface{}) bool

更新数据流

func (*MountManager) Write

func (mm *MountManager) Write(path string, contents string, conf ...map[string]interface{}) bool

写入文件

func (*MountManager) WriteStream

func (mm *MountManager) WriteStream(path string, resource *os.File, conf ...map[string]interface{}) bool

写入数据流

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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