Files
BingPaper/internal/storage/storage.go

29 lines
630 B
Go

package storage
import (
"context"
"io"
)
type StoredObject struct {
Key string
ContentType string
Size int64
PublicURL string
}
type Storage interface {
Put(ctx context.Context, key string, r io.Reader, contentType string) (StoredObject, error)
Get(ctx context.Context, key string) (io.ReadCloser, string, error)
Delete(ctx context.Context, key string) error
PublicURL(key string) (string, bool)
Exists(ctx context.Context, key string) (bool, error)
}
var GlobalStorage Storage
func InitStorage() error {
// 实际初始化在 main.go 中根据配置调用对应的初始化函数
return nil
}