Documentation ¶
Index ¶
- type AliOSS
- func (a *AliOSS) DeleteFile(_ context.Context, objectName string) error
- func (a *AliOSS) DownloadFile(_ context.Context, objectName string) (io.ReadCloser, error)
- func (a *AliOSS) GetFileURL(_ context.Context, objectName string) (string, error)
- func (a *AliOSS) UploadFile(_ context.Context, objectName string, reader io.Reader, _ int64) error
- type Client
- type LocalStorage
- func (l *LocalStorage) DeleteFile(_ context.Context, objectName string) error
- func (l *LocalStorage) DownloadFile(_ context.Context, objectName string) (io.ReadCloser, error)
- func (l *LocalStorage) GetFileURL(_ context.Context, objectName string) (string, error)
- func (l *LocalStorage) UploadFile(_ context.Context, objectName string, reader io.Reader, _ int64) error
- type MinIOClient
- func (m *MinIOClient) DeleteFile(ctx context.Context, objectName string) error
- func (m *MinIOClient) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
- func (m *MinIOClient) GetFileURL(_ context.Context, objectName string) (string, error)
- func (m *MinIOClient) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error
- type TencentOss
- func (t *TencentOss) DeleteFile(ctx context.Context, objectName string) error
- func (t *TencentOss) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
- func (t *TencentOss) GenerateCOSURL(bucketName, region, secretID, secretKey, objectKey string, isPublic bool, ...) (string, error)
- func (t *TencentOss) GetFileURL(_ context.Context, objectName string) (string, error)
- func (t *TencentOss) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliOSS ¶
type AliOSS struct {
// contains filtered or unexported fields
}
AliOSS 阿里云OSS
func (*AliOSS) DeleteFile ¶
DeleteFile 删除文件
func (*AliOSS) DownloadFile ¶
DownloadFile 下载文件
func (*AliOSS) GetFileURL ¶ added in v1.1.37
GetFileURL 获取文件URL
type Client ¶ added in v1.1.37
type Client interface { // UploadFile 上传文件 UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error // DownloadFile 下载文件 DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error) // DeleteFile 删除文件 DeleteFile(ctx context.Context, objectName string) error // GetFileURL 获取文件访问链接 GetFileURL(ctx context.Context, objectName string) (string, error) }
Client oss 客户端
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage 本地存储实现
func NewLocalStorage ¶
func NewLocalStorage(conf *conf.LocalStorage) *LocalStorage
NewLocalStorage 创建一个新的本地存储实例
func (*LocalStorage) DeleteFile ¶
func (l *LocalStorage) DeleteFile(_ context.Context, objectName string) error
DeleteFile 删除本地文件
func (*LocalStorage) DownloadFile ¶
func (l *LocalStorage) DownloadFile(_ context.Context, objectName string) (io.ReadCloser, error)
DownloadFile 从本地存储中读取文件
func (*LocalStorage) GetFileURL ¶ added in v1.1.37
GetFileURL 获取文件的URL
func (*LocalStorage) UploadFile ¶
func (l *LocalStorage) UploadFile(_ context.Context, objectName string, reader io.Reader, _ int64) error
UploadFile 将文件存储到本地
type MinIOClient ¶
type MinIOClient struct {
// contains filtered or unexported fields
}
MinIOClient MinIO客户端
func (*MinIOClient) DeleteFile ¶
func (m *MinIOClient) DeleteFile(ctx context.Context, objectName string) error
DeleteFile 删除文件
func (*MinIOClient) DownloadFile ¶
func (m *MinIOClient) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
DownloadFile 下载文件
func (*MinIOClient) GetFileURL ¶ added in v1.1.37
GetFileURL 获取文件URL
func (*MinIOClient) UploadFile ¶
func (m *MinIOClient) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error
UploadFile 上传文件
type TencentOss ¶
type TencentOss struct {
// contains filtered or unexported fields
}
TencentOss 腾讯云对象存储服务
func NewTencentOss ¶
func NewTencentOss(conf *conf.TencentOss) (*TencentOss, error)
NewTencentOss 创建腾讯云对象存储服务
func (*TencentOss) DeleteFile ¶
func (t *TencentOss) DeleteFile(ctx context.Context, objectName string) error
DeleteFile 删除文件
func (*TencentOss) DownloadFile ¶
func (t *TencentOss) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
DownloadFile 下载文件
func (*TencentOss) GenerateCOSURL ¶
func (t *TencentOss) GenerateCOSURL(bucketName, region, secretID, secretKey, objectKey string, isPublic bool, expiry time.Duration) (string, error)
GenerateCOSURL 生成腾讯云 COS 文件的访问 URL
func (*TencentOss) GetFileURL ¶ added in v1.1.37
GetFileURL 获取文件URL
func (*TencentOss) UploadFile ¶
func (t *TencentOss) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error
UploadFile 上传文件
Click to show internal directories.
Click to hide internal directories.