oss

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 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
}

AliOSS 阿里云OSS

func NewAliOSS

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

NewAliOSS 创建阿里云OSS客户端

func (*AliOSS) DeleteFile

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

DeleteFile 删除文件

func (*AliOSS) DownloadFile

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

DownloadFile 下载文件

func (*AliOSS) GetFileURL added in v1.1.37

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

GetFileURL 获取文件URL

func (*AliOSS) UploadFile

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

UploadFile 上传文件

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

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

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

func (m *MinIOClient) GetFileURL(_ context.Context, objectName string) (string, error)

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

func (t *TencentOss) GetFileURL(_ context.Context, objectName string) (string, error)

GetFileURL 获取文件URL

func (*TencentOss) UploadFile

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

UploadFile 上传文件

Jump to

Keyboard shortcuts

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