Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsQiniu ¶
func AsQiniu(fs Filesystem) (*qiniu.QiniuFilesystem, bool)
AsQiniu 将通用文件系统转换为七牛云文件系统 如果不是七牛云文件系统,第二个返回值为 false
func BuildUploadKey ¶
BuildUploadKey 生成上传文件的key
func MustAsQiniu ¶
func MustAsQiniu(fs Filesystem) *qiniu.QiniuFilesystem
Types ¶
type Filesystem ¶
type Filesystem interface { Put(ctx context.Context, path string, data []byte) error // 将数据写入文件 PutWithoutContext(path string, data []byte) error // 将数据写入文件不带上下文 Get(path string) ([]byte, error) // 获取文件内容 GetUrl(path string) string // 获取文件的URL // GetSignedUrl 获取签名URL // path: 文件路径 // expires: 过期时间 单位/秒 GetSignedUrl(path string, expires int64) (string, error) GetImageWidthHeight(path string) (int, int, error) // 获取图片的宽高 MustGetSignedUrl(path string, expires int64) string // 获取签名URL Delete(path string) error // 删除文件 Exists(path string) bool // 判断文件是否存在 }
Filesystem 文件系统接口
func NewStorageWithError ¶
func NewStorageWithError(driver config.FilesystemDriver) (Filesystem, error)
NewStorageWithError 带错误信息的文件系统创建
Click to show internal directories.
Click to hide internal directories.