oss

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 NewAliOSS

func NewAliOSS(conf *conf.AliOss) (*AliOSS, error)

NewAliOSS 创建阿里云OSS客户端

func (*AliOSS) DeleteFile

func (a *AliOSS) DeleteFile(_ context.Context, objectName string) error

func (*AliOSS) DownloadFile

func (a *AliOSS) DownloadFile(_ context.Context, objectName string) (io.ReadCloser, error)

func (*AliOSS) GetFileUrl

func (a *AliOSS) GetFileUrl(_ context.Context, objectName string) (string, error)

func (*AliOSS) UploadFile

func (a *AliOSS) UploadFile(_ context.Context, objectName string, reader io.Reader, _ int64) error

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

func (l *LocalStorage) GetFileUrl(_ context.Context, objectName string) (string, error)

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 NewMinIO

func NewMinIO(minioConf *conf.Minio) (*MinIOClient, error)

NewMinIO 创建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 (m *MinIOClient) GetFileUrl(_ context.Context, objectName string) (string, error)

func (*MinIOClient) UploadFile

func (m *MinIOClient) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error

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 (t *TencentOss) GetFileUrl(_ context.Context, objectName string) (string, error)

func (*TencentOss) UploadFile

func (t *TencentOss) UploadFile(ctx context.Context, objectName string, reader io.Reader, objectSize int64) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL