cloud

package
v0.0.0-...-14c708c Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0, Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressByGzip

func CompressByGzip(tmpFile, saveFile string) (err error)

func MD5Crypt

func MD5Crypt(str string) string

MD5 Crypt

Types

type BOS

type BOS struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Endpoint  string
	Domain    string
	Client    *bos.Client
}

func NewBOS

func NewBOS(accessKey, secretKey, bucket, endpoint, domain string) (b *BOS, err error)

new bos

func (*BOS) Delete

func (b *BOS) Delete(objects ...string) (err error)

func (*BOS) Download

func (b *BOS) Download(object string, savePath string) (err error)

func (*BOS) GetInfo

func (b *BOS) GetInfo(object string) (info File, err error)

func (*BOS) GetSignURL

func (b *BOS) GetSignURL(object string, expire int64) (link string, err error)

func (*BOS) IsExist

func (b *BOS) IsExist(object string) (err error)

func (*BOS) Lists

func (b *BOS) Lists(prefix string) (files []File, err error)

func (*BOS) Upload

func (b *BOS) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

type COS

type COS struct {
	AccessKey string
	SecretKey string
	Bucket    string
	AppID     string
	Region    string
	Domain    string
	Client    *cos.Client
}

func NewCOS

func NewCOS(accessKey, secretKey, bucket, appId, region, domain string) (c *COS, err error)

func (*COS) Delete

func (c *COS) Delete(objects ...string) (err error)

func (*COS) Download

func (c *COS) Download(object string, savePath string) (err error)

func (*COS) GetInfo

func (c *COS) GetInfo(object string) (info File, err error)

func (*COS) GetSignURL

func (c *COS) GetSignURL(object string, expire int64) (link string, err error)

func (*COS) IsExist

func (c *COS) IsExist(object string) (err error)

func (*COS) Lists

func (c *COS) Lists(prefix string) (files []File, err error)

func (*COS) Upload

func (c *COS) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

type CloudStore

type CloudStore interface {
	Delete(objects ...string) (err error)                                             // 删除文件
	GetSignURL(object string, expire int64) (link string, err error)                  // 文件访问签名
	IsExist(object string) (err error)                                                // 判断文件是否存在
	Lists(prefix string) (files []File, err error)                                    // 文件前缀,列出文件
	Upload(tmpFile string, saveFile string, headers ...map[string]string) (err error) // 上传文件
	Download(object string, savePath string) (err error)                              // 下载文件
	GetInfo(object string) (info File, err error)                                     // 获取指定文件信息
}

type File

type File struct {
	ModTime time.Time
	Name    string
	Size    int64
	IsDir   bool
	Header  map[string]string
}

type MinIO

type MinIO struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Endpoint  string
	Domain    string
	Client    *minio.Client
}

func NewMinIO

func NewMinIO(accessKey, secretKey, bucket, endpoint, domain string) (m *MinIO, err error)

func (*MinIO) Delete

func (m *MinIO) Delete(objects ...string) (err error)

func (*MinIO) Download

func (m *MinIO) Download(object string, savePath string) (err error)

func (*MinIO) GetInfo

func (m *MinIO) GetInfo(object string) (info File, err error)

func (*MinIO) GetSignURL

func (m *MinIO) GetSignURL(object string, expire int64) (link string, err error)

func (*MinIO) IsExist

func (m *MinIO) IsExist(object string) (err error)

func (*MinIO) Lists

func (m *MinIO) Lists(prefix string) (files []File, err error)

func (*MinIO) Upload

func (m *MinIO) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

type OBS

type OBS struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Endpoint  string
	Domain    string
	Client    *obs.ObsClient
}

func NewOBS

func NewOBS(accessKey, secretKey, bucket, endpoint, domain string) (o *OBS, err error)

func (*OBS) Delete

func (o *OBS) Delete(objects ...string) (err error)

func (*OBS) Download

func (o *OBS) Download(object string, savePath string) (err error)

func (*OBS) GetInfo

func (o *OBS) GetInfo(object string) (info File, err error)

func (*OBS) GetSignURL

func (o *OBS) GetSignURL(object string, expire int64) (link string, err error)

func (*OBS) IsExist

func (o *OBS) IsExist(object string) (err error)

func (*OBS) Lists

func (o *OBS) Lists(prefix string) (files []File, err error)

func (*OBS) Upload

func (o *OBS) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

type OSS

type OSS struct {
	AccessKey string
	SecretKey string
	Endpoint  string
	Bucket    string
	Domain    string
	Client    *oss.Bucket
}

func NewOSS

func NewOSS(accessKey, secretKey, endpoint, bucket, domain string) (o *OSS, err error)

New OSS

func (*OSS) Delete

func (o *OSS) Delete(objects ...string) (err error)

func (*OSS) Download

func (o *OSS) Download(object string, savePath string) (err error)

func (*OSS) GetInfo

func (o *OSS) GetInfo(object string) (info File, err error)

func (*OSS) GetSignURL

func (o *OSS) GetSignURL(object string, expire int64) (link string, err error)

func (*OSS) IsExist

func (o *OSS) IsExist(object string) (err error)

func (*OSS) Lists

func (o *OSS) Lists(prefix string) (files []File, err error)

func (*OSS) Upload

func (o *OSS) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

type QINIU

type QINIU struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Domain    string
	Zone      *storage.Zone

	BucketManager *storage.BucketManager
	// contains filtered or unexported fields
}

func NewQINIU

func NewQINIU(accessKey, secretKey, bucket, domain string) (q *QINIU, err error)

func (*QINIU) Delete

func (q *QINIU) Delete(objects ...string) (err error)

func (*QINIU) Download

func (q *QINIU) Download(object string, savePath string) (err error)

func (*QINIU) GetInfo

func (q *QINIU) GetInfo(object string) (info File, err error)

func (*QINIU) GetSignURL

func (q *QINIU) GetSignURL(object string, expire int64) (link string, err error)

func (*QINIU) IsExist

func (q *QINIU) IsExist(object string) (err error)

func (*QINIU) Lists

func (q *QINIU) Lists(prefix string) (files []File, err error)

func (*QINIU) Upload

func (q *QINIU) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

TODO: 目前没发现有可以设置header的地方

type UpYun

type UpYun struct {
	Bucket   string
	Operator string
	Password string
	Domain   string
	Client   *upyun.UpYun
	// contains filtered or unexported fields
}

func NewUpYun

func NewUpYun(bucket, operator, password, domain, secret string) *UpYun

func (*UpYun) Delete

func (u *UpYun) Delete(objects ...string) (err error)

func (*UpYun) Download

func (u *UpYun) Download(object string, savePath string) (err error)

func (*UpYun) GetInfo

func (u *UpYun) GetInfo(object string) (info File, err error)

func (*UpYun) GetSignURL

func (u *UpYun) GetSignURL(object string, expire int64) (link string, err error)

https://help.upyun.com/knowledge-base/cdn-token-limite/

func (*UpYun) IsExist

func (u *UpYun) IsExist(object string) (err error)

func (*UpYun) Lists

func (u *UpYun) Lists(prefix string) (files []File, err error)

func (*UpYun) Upload

func (u *UpYun) Upload(tmpFile, saveFile string, headers ...map[string]string) (err error)

Jump to

Keyboard shortcuts

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