interfaces

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {

	// 设置前缀
	SetPathPrefix(string)

	// 获取前缀
	GetPathPrefix() string

	// 添加前缀
	ApplyPathPrefix(string) string

	// 移除前缀
	RemovePathPrefix(string) string

	// 判断
	Has(string) bool

	// 上传
	Write(string, string, Config) (map[string]interface{}, error)

	// 上传 Stream 文件类型
	WriteStream(string, io.Reader, Config) (map[string]interface{}, error)

	// 更新
	Update(string, string, Config) (map[string]interface{}, error)

	// 更新
	UpdateStream(string, io.Reader, Config) (map[string]interface{}, error)

	// 读取
	Read(string) (map[string]interface{}, error)

	// 读取文件为数据流
	ReadStream(string) (map[string]interface{}, error)

	// 重命名
	Rename(string, string) error

	// 复制
	Copy(string, string) error

	// 删除
	Delete(string) error

	// 删除文件夹
	DeleteDir(string) error

	// 创建文件夹
	CreateDir(string, Config) (map[string]string, error)

	// 列出内容
	ListContents(string, ...bool) ([]map[string]interface{}, error)

	// 文件信息
	GetMetadata(string) (map[string]interface{}, error)

	// 文件大小
	GetSize(string) (map[string]interface{}, error)

	// 类型
	GetMimetype(string) (map[string]interface{}, error)

	// 获取时间戳
	GetTimestamp(string) (map[string]interface{}, error)

	// 获取文件的权限
	GetVisibility(string) (map[string]string, error)

	// 设置文件的权限
	SetVisibility(string, string) (map[string]string, error)
}

*

  • 适配器接口 *
  • @create 2021-8-1
  • @author deatil

type Config

type Config interface {
	// 设置配置信息
	WithSetting(map[string]interface{}) Config

	// 设置配置信息
	With(string, interface{}) Config

	// 获取一个设置
	Get(string) interface{}

	// 通过一个 key 值判断设置是否存在
	Has(string) bool

	// 获取一个值带默认
	GetDefault(string, ...interface{}) interface{}

	// 设置
	Set(string, interface{}) Config

	// 设置一个 fallback
	SetFallback(Config) Config
}

*

  • 配置接口 *
  • @create 2021-8-1
  • @author deatil

type Fllesystem

type Fllesystem interface {
	// 设置配置
	SetConfig(Config)

	// 获取配置
	GetConfig() Config

	// 提前设置配置
	PrepareConfig(map[string]interface{}) Config

	// 设置适配器
	WithAdapter(Adapter) Fllesystem

	// 获取适配器
	GetAdapter() Adapter

	// 获取
	GetFllesystem() Fllesystem

	// 判断
	Has(string) bool

	// 上传
	Write(string, string, ...map[string]interface{}) bool

	// 上传
	WriteStream(string, io.Reader, ...map[string]interface{}) bool

	// 上传
	Put(string, string, ...map[string]interface{}) bool

	// 上传
	PutStream(string, io.Reader, ...map[string]interface{}) bool

	// 更新
	Update(string, string, ...map[string]interface{}) bool

	// 更新
	UpdateStream(string, io.Reader, ...map[string]interface{}) bool

	// 读取
	Read(string) interface{}

	// 读取
	ReadStream(string) *os.File

	// 重命名
	Rename(string, string) bool

	// 复制
	Copy(string, string) bool

	// 删除
	Delete(string) bool

	// 读取并删除
	ReadAndDelete(string) (interface{}, error)

	// 删除文件夹
	DeleteDir(string) bool

	// 创建文件夹
	CreateDir(string, ...map[string]interface{}) bool

	// 列出数据
	ListContents(string, ...bool) []map[string]interface{}

	// 文件 mime-type
	GetMimetype(string) string

	// 文件时间
	GetTimestamp(string) int64

	// 权限
	GetVisibility(string) string

	// 大小
	GetSize(string) int64

	// 设置权限
	SetVisibility(string, string) bool

	// 信息数据
	GetMetadata(string) map[string]interface{}

	// 获取
	Get(string, ...func(Fllesystem, string) interface{}) interface{}
}

*

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

Jump to

Keyboard shortcuts

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