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 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 OssClient
- 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
}
func (*AliOSS) DownloadFile ¶
func (*AliOSS) GetFileUrl ¶
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 ¶
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
func (*MinIOClient) DownloadFile ¶
func (m *MinIOClient) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
func (*MinIOClient) GetFileUrl ¶
func (*MinIOClient) UploadFile ¶
type OssClient ¶
type OssClient 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) }
OssClient oss 客户端
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
func (*TencentOss) DownloadFile ¶
func (t *TencentOss) DownloadFile(ctx context.Context, objectName string) (io.ReadCloser, error)
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 ¶
func (*TencentOss) UploadFile ¶
Click to show internal directories.
Click to hide internal directories.