Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateULID ¶
func GenerateULID() string
GenerateULID 生成一个新的 ULID(带时间顺序,可排序) 参考:01K8FJ3Q3WA031F7YPV0E9PRBP
Types ¶
type Client ¶
type Client struct {
Bucket string
Endpoint string // 新增:存储 endpoint 用于构建 URL
Region string // 新增:存储 region 用于构建 URL
UseSSL bool // 新增:存储 SSL 配置用于构建 URL
// contains filtered or unexported fields
}
Client 封装 S3 客户端
func (*Client) Upload ¶
func (c *Client) Upload( ctx context.Context, filePath string, options *UploadOptions, ) (*UploadResult, error)
Upload 上传本地文件到 S3 功能特性: - 自动检测文件 MIME 类型 - 支持 ULID 重命名或保留原文件名 - 支持设置公开可读权限 - 返回完整的访问链接和元数据
type UploadOptions ¶
type UploadOptions struct {
Directory string // Directory S3 存储目录路径(可选)
PreserveName bool // PreserveName 是否保留原始文件名(默认 false)
}
UploadOptions 上传配置
Click to show internal directories.
Click to hide internal directories.