storage

package
v0.0.0-...-3cf0c3c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBucketNameNotIsNil 桶名称不能为空
	ErrBucketNameNotIsNil = errors.New("BucketName not is nil")
)

Functions

func FromBucketNameContext

func FromBucketNameContext(ctx context.Context) (bucketName string, ok bool)

FromBucketNameContext ...

func FromContentTypeContext

func FromContentTypeContext(ctx context.Context) (contentType string, ok bool)

FromContentTypeContext ...

func NewBucketNameContext

func NewBucketNameContext(ctx context.Context, bucketName string) context.Context

NewBucketNameContext ...

func NewContentTypeContext

func NewContentTypeContext(ctx context.Context, contentType string) context.Context

NewContentTypeContext ...

Types

type AliyunOssStorage

type AliyunOssStorage struct {
	CheckAndCreateBucketEnabled bool
	// contains filtered or unexported fields
}

AliyunOssStorage 阿里云oss存储

func NewAliyunOssStorage

func NewAliyunOssStorage(ossClient *oss.Client, initBucket bool, bucketNames []string) (os *AliyunOssStorage, err error)

NewAliyunOssStorage 创建阿里云oss存储

func (*AliyunOssStorage) CheckAndCreateBucket

func (ds *AliyunOssStorage) CheckAndCreateBucket(bucketName string) (err error)

CheckAndCreateBucket 检查并创建桶

func (*AliyunOssStorage) Download

func (ds *AliyunOssStorage) Download(ctx context.Context, dist io.Writer, filename string) (info storage.DownloadFileInfoer, err error)

Download 下载

func (*AliyunOssStorage) Exist

func (ds *AliyunOssStorage) Exist(ctx context.Context, filename string) (exist bool, err error)

Exist 判断文件是否存在

func (*AliyunOssStorage) Remove

func (ds *AliyunOssStorage) Remove(ctx context.Context, filename string) (err error)

Remove 删除

func (*AliyunOssStorage) Upload

func (ds *AliyunOssStorage) Upload(ctx context.Context, read io.Reader, filename string) (fullName string, err error)

Upload 上传

type MinioStorage

type MinioStorage struct {
	CheckAndCreateBucketEnabled bool
	// contains filtered or unexported fields
}

MinioStorage minio存储

func NewMinioStorage

func NewMinioStorage(minioClient *minio.Client, location string, initBucket bool, bucketNames []string) (ms *MinioStorage, err error)

NewMinioStorage 创建minio存储

func (*MinioStorage) CheckAndCreateBucket

func (ds *MinioStorage) CheckAndCreateBucket(bucketName string) (err error)

CheckAndCreateBucket 检查并创建桶

func (*MinioStorage) Download

func (ds *MinioStorage) Download(ctx context.Context, dist io.Writer, filename string) (info storage.DownloadFileInfoer, err error)

Download 下载

func (*MinioStorage) Exist

func (ds *MinioStorage) Exist(ctx context.Context, filename string) (exist bool, err error)

Exist 是否存在

func (*MinioStorage) Remove

func (ds *MinioStorage) Remove(ctx context.Context, filename string) (err error)

Remove 删除

func (*MinioStorage) Upload

func (ds *MinioStorage) Upload(ctx context.Context, read io.Reader, filename string) (fullName string, err error)

Upload 上传

Jump to

Keyboard shortcuts

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