mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 10:19:32 +08:00
基本功能实现
This commit is contained in:
27
internal/storage/storage.go
Normal file
27
internal/storage/storage.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
|
||||
var GlobalStorage Storage
|
||||
|
||||
func InitStorage() error {
|
||||
// 实际初始化在 main.go 中根据配置调用对应的初始化函数
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user