Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(storageType shared.StorageType, f Factory)
func Storages ¶
func Storages() map[shared.StorageType]Storage
Types ¶
type Storage ¶
type Storage interface {
Init(ctx context.Context) error
// from: 本地文件路径, to: 存储路径 (如 "2023/01/01/xxxx.jpg")
//
// 存储实现可能会对传入的存储路径进行其他处理 (如添加前缀), 因此返回的 StorageDetail 中的 Path 可能与传入的 storagePath 不同.
Save(ctx context.Context, file io.Reader, to string) (*shared.StorageDetail, error)
GetFile(ctx context.Context, info shared.StorageDetail) (io.ReadCloser, error)
Delete(ctx context.Context, info shared.StorageDetail) error
}
Click to show internal directories.
Click to hide internal directories.