instance

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigType

func GetConfigType(config Config) (cfg interface{})

Types

type CloudStore

type CloudStore struct {
	Private       bool
	StoreType     StoreType
	CanGZIP       bool
	Client        interface{}
	Config        interface{}
	Expire        int64
	PublicDomain  string
	PrivateDomain string
}

func NewCloudStore

func NewCloudStore(storeConf Config, private bool) (cs *CloudStore, err error)

创建云存储 config 相应存储的struct指针 storetype 云存储对应的名字 private false不使用普通网络

func NewCloudStoreWithConfig

func NewCloudStoreWithConfig(storeConfig interface{}, storeType StoreType, private bool) (cs *CloudStore, err error)

func (*CloudStore) Delete

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

func (*CloudStore) GetPublicDomain

func (c *CloudStore) GetPublicDomain() (domain string)

func (*CloudStore) GetSignURL

func (c *CloudStore) GetSignURL(object string) (link string)

func (*CloudStore) IsExist

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

err 返回 nil,表示文件存在,否则表示文件不存在

func (*CloudStore) Lists

func (c *CloudStore) Lists(object string) (files []cloud.File, err error)

func (*CloudStore) PingTest

func (c *CloudStore) PingTest() (err error)

func (*CloudStore) Upload

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

type Config

type Config struct {
	AccessKey           string
	SecretKey           string
	Endpoint            string
	Region              string
	AppId               string
	PublicBucket        string
	PublicBucketDomain  string
	PrivateBucket       string
	PrivateBucketDomain string
	Expire              int64
	CloudType           StoreType
}

type ConfigBos

type ConfigBos struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigCos

type ConfigCos struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Region              string `store:"region" fieldName:"Region"`
	AppId               string `store:"app-id" fieldName:"AppId"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigMinio

type ConfigMinio struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigObs

type ConfigObs struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigOss

type ConfigOss struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigQiniu

type ConfigQiniu struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type ConfigUpYun

type ConfigUpYun struct {
	AccessKey           string `store:"access-key" fieldName:"AccessKey"`
	SecretKey           string `store:"secret-key" fieldName:"SecretKey"`
	Endpoint            string `store:"endpoint" fieldName:"Endpoint"`
	PublicBucket        string `store:"public-bucket" fieldName:"PublicBucket"`
	PublicBucketDomain  string `store:"public-bucket-domain" fieldName:"PublicBucketDomain"`
	PrivateBucket       string `store:"private-bucket" fieldName:"PrivateBucket"`
	PrivateBucketDomain string `store:"private-bucket-domain" fieldName:"PrivateBucketDomain"`
	Expire              int64  `store:"expire" fieldName:"Expire"`
}

type StoreType

type StoreType string
var (
	Oss   StoreType = "oss"   //oss存储
	Minio StoreType = "minio" //minio存储
	Cos   StoreType = "cos"   //腾讯云存储
	Obs   StoreType = "obs"   //华为云存储
	Bos   StoreType = "bos"   //百度云存储
	Qiniu StoreType = "qiniu" //七牛云储存
	Upyun StoreType = "upyun" //又拍云存储
)

Jump to

Keyboard shortcuts

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