2019-12-08 22:17:36 +08:00
|
|
|
|
package response
|
|
|
|
|
|
2020-04-24 11:08:07 +08:00
|
|
|
|
import (
|
|
|
|
|
"io"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
2019-12-08 22:17:36 +08:00
|
|
|
|
|
|
|
|
|
// ContentResponse 获取文件内容类方法的通用返回值。
|
|
|
|
|
// 有些上传策略需要重定向,
|
|
|
|
|
// 有些直接写文件数据到浏览器
|
|
|
|
|
type ContentResponse struct {
|
|
|
|
|
Redirect bool
|
2019-12-31 13:09:26 +08:00
|
|
|
|
Content RSCloser
|
2019-12-08 22:17:36 +08:00
|
|
|
|
URL string
|
2020-02-01 10:08:34 +08:00
|
|
|
|
MaxAge int
|
2019-12-08 22:17:36 +08:00
|
|
|
|
}
|
2019-12-13 20:54:28 +08:00
|
|
|
|
|
2019-12-31 13:09:26 +08:00
|
|
|
|
// RSCloser 存储策略适配器返回的文件流,有些策略需要带有Closer
|
2019-12-13 20:54:28 +08:00
|
|
|
|
type RSCloser interface {
|
|
|
|
|
io.ReadSeeker
|
|
|
|
|
io.Closer
|
|
|
|
|
}
|
2020-04-24 11:08:07 +08:00
|
|
|
|
|
|
|
|
|
// Object 列出文件、目录时返回的对象
|
|
|
|
|
type Object struct {
|
2020-04-28 10:02:53 +08:00
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
RelativePath string `json:"relative_path"`
|
|
|
|
|
Source string `json:"source"`
|
|
|
|
|
Size uint64 `json:"size"`
|
|
|
|
|
IsDir bool `json:"is_dir"`
|
|
|
|
|
LastModify time.Time `json:"last_modify"`
|
2020-04-24 11:08:07 +08:00
|
|
|
|
}
|