Private
Public Access
1
0
Files
u-desk/internal/oss/types.go

61 lines
1.6 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package oss
import "time"
// FileInfo 文件信息
type FileInfo struct {
Key string // 文件key
Size int64 // 文件大小
ETag string // 文件hash
ContentType string // 文件类型
LastModified time.Time // 最后修改时间
Metadata map[string]string // 自定义元数据
}
// UploadOptions 上传选项
type UploadOptions struct {
ContentType string // 文件类型
Metadata map[string]string // 自定义元数据
Callback *UploadProgressCallback // 进度回调
}
// UploadProgressCallback 上传进度回调
type UploadProgressCallback struct {
OnProgress func(current, total int64)
}
// UploadResult 上传结果
type UploadResult struct {
Key string // 文件key
ETag string // 文件hash
Size int64 // 文件大小
}
// ListOptions 列举选项
type ListOptions struct {
Prefix string // 前缀过滤
MaxKeys int // 最大返回数量
Marker string // 分页标记
Delimiter string // 分隔符(用于目录模拟)
}
// ListResult 列举结果
type ListResult struct {
Files []FileInfo // 文件列表
Prefixes []string // 公共前缀(模拟目录)
IsTruncated bool // 是否还有更多数据
NextMarker string // 下一页标记
}
// BucketEntry 桶信息
type BucketEntry struct {
Name string // 桶名
Region string // 区域(七牛默认 "z0",阿里云如 "oss-cn-hangzhou"
}
// DeleteResult 删除结果
type DeleteResult struct {
Deleted []string // 成功删除的文件
Errors []string // 失败的文件
}