feat: 完成基本功能

(
  1. 新建连接
  2. 新建桶
  3. 上传文件
  4. 下载文件
  5. 预览图片
)
This commit is contained in:
zhaoyupeng
2024-10-14 18:08:49 +08:00
parent 660c5a7efb
commit a0c3ee8ac0
22 changed files with 981 additions and 658 deletions

View File

@ -12,10 +12,10 @@ import (
)
type ObjectInfo struct {
Bucket string
Key string
ContentType string
Expire int64
Bucket string `json:"bucket"`
Key string `json:"key"`
ContentType string `json:"content_type"`
Expire int64 `json:"expire"`
}
func (c *Client) GetObjectInfo(ctx context.Context, bucket string, key string) (*ObjectInfo, error) {
@ -62,9 +62,9 @@ func (presigner *Presigner) GetObject(ctx context.Context, bucketName string, ob
}
type ObjectEntry struct {
URL string
Method string
Header http.Header
URL string `json:"url"`
Method string `json:"method"`
Header http.Header `json:"header"`
}
func (c *Client) GetObjectEntry(ctx context.Context, bucket string, key string, lifetimes ...int64) (*ObjectEntry, error) {
@ -92,7 +92,7 @@ func (c *Client) GetObjectEntry(ctx context.Context, bucket string, key string,
type ObjectEntity struct {
ObjectInfo
Body io.ReadCloser
Body io.ReadCloser `json:"body"`
}
func (c *Client) GetObject(ctx context.Context, bucket string, key string) (*ObjectEntity, error) {