cloudstore

package
v0.0.0-...-d5765cb Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACLPrivate         = "private"           // 私有权限
	ACLPublicRead      = "public-read"       // 公共读
	ACLPublicReadWrite = "public-read-write" // 公共读写
)
View Source
const (
	AlyOssType    = 0 // 阿里云oss
	QiniuyOssType = 1 // 七牛云
	UpyOssType    = 2 // 又拍云
	TxOssType     = 3 // 腾讯云
)
View Source
const (
	AlyOssDomain    = 0 // oss 域名
	AlyOssDiyDomain = 1 // oss 自定义域名
	AlyOssSts       = 2 // sts新建client
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlyOssBucketJsonData

type AlyOssBucketJsonData struct {
	Code  int         `json:"code"`  //错误代码
	Count int         `json:"count"` // 数据数量
	Msg   string      `json:"msg"`   //输出信息
	Data  interface{} `json:"data"`  //数据
}

type AlyOssConfigOption

type AlyOssConfigOption struct {
	Bucket    string // 命令存储空间
	Accesskey string // 用户 key id
	Secretkey string // 用户 key value
	// https://helpcdn.aliyun.com/document_detail/31837.html
	Endpoint      string // 地域节点 oss-cn-zhangjiakou.aliyuncs.com 不带http://
	SecurityToken string
}

阿里云对象存储配置

type AlyOssObj

type AlyOssObj struct {
	Opt     AlyOssConfigOption
	Newtype int // 以什么方式创建Clinet

	BucketMap map[string]*oss.Bucket
	// contains filtered or unexported fields
}

func (*AlyOssObj) Close

func (c *AlyOssObj) Close()

func (*AlyOssObj) CreateBucket

func (c *AlyOssObj) CreateBucket(bucketName string)

创建存储空间,根目录下的 Bucket

func (*AlyOssObj) DeleteBucket

func (c *AlyOssObj) DeleteBucket(bucketName string)

func (*AlyOssObj) DeleteBucketObj

func (c *AlyOssObj) DeleteBucketObj(bucketName string)

移除map

func (*AlyOssObj) DeleteObject

func (c *AlyOssObj) DeleteObject(bucketName, objectName string)

删除文件

func (*AlyOssObj) Download

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

func (*AlyOssObj) GetInfo

func (c *AlyOssObj) GetInfo(bucketName, object string) (info go_oss.File, err error)

func (*AlyOssObj) GetUrl

func (c *AlyOssObj) GetUrl(bucket, dndpoint, objectName string) string

func (*AlyOssObj) Init

func (c *AlyOssObj) Init() bool

初始化

func (*AlyOssObj) IsBucketExist

func (c *AlyOssObj) IsBucketExist(bucketName string) bool

存储空间是否存在

func (*AlyOssObj) ListBuckets

func (c *AlyOssObj) ListBuckets()

列举存储空间

func (*AlyOssObj) ListObjects

func (c *AlyOssObj) ListObjects(bucketName string) (files []go_oss.File, err error)

func (*AlyOssObj) NewAlyOssObj

func (c *AlyOssObj) NewAlyOssObj(accessKey, secretKey, bucket, endpoint string, securityToken string, newType int) (err error)

func (*AlyOssObj) OpenBucket

func (c *AlyOssObj) OpenBucket(bucketName string) (err error)

打开 bucket空间

func (*AlyOssObj) PutObjectFromFile

func (c *AlyOssObj) PutObjectFromFile(bucketName, objectName, localFileName string, args ...string) string

上传文件

func (*AlyOssObj) UploadString

func (c *AlyOssObj) UploadString(bucketName, tmpstr string, args ...string) string

上传字符串,末尾带/表示创建文件夹 如 /img/

type CosConfigOption

type CosConfigOption struct {
	Bucket    string
	APPID     string
	Region    string
	SecretID  string
	SecretKey string
}

腾讯云对象存储配置

type ObsConfigOption

type ObsConfigOption struct {
	Accesskey string
	Secretkey string
	Bucket    string
	Endpoint  string
	Domain    string
}

华为云配置

type ObsObj

type ObsObj struct {
	Opt     ObsConfigOption
	Newtype int // 以什么方式创建Clinet

	BucketMap map[string]*obs.GetObjectOutput
	// contains filtered or unexported fields
}

func (*ObsObj) Close

func (c *ObsObj) Close()

func (*ObsObj) CreateBucket

func (c *ObsObj) CreateBucket(bucketName string)

func (*ObsObj) DeleteBucket

func (c *ObsObj) DeleteBucket(bucketName string)

func (*ObsObj) DeleteBucketObj

func (c *ObsObj) DeleteBucketObj(bucketName string)

func (*ObsObj) DeleteObject

func (c *ObsObj) DeleteObject(bucketName, objectName string)

func (*ObsObj) Download

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

func (*ObsObj) GetInfo

func (c *ObsObj) GetInfo(bucketName, object string) (info go_oss.File, err error)

func (*ObsObj) GetUrl

func (c *ObsObj) GetUrl(bucket, dndpoint, objectName string) string

func (*ObsObj) Init

func (c *ObsObj) Init() bool

初始化

func (*ObsObj) IsBucketExist

func (c *ObsObj) IsBucketExist(bucketName string) bool

func (*ObsObj) ListBuckets

func (c *ObsObj) ListBuckets()

func (*ObsObj) ListObjects

func (c *ObsObj) ListObjects(bucketName string) (files []go_oss.File, err error)

func (*ObsObj) NewObj

func (c *ObsObj) NewObj(accessKey, secretKey, bucket, endpoint string, securityToken string, newType int) (err error)

func (*ObsObj) OpenBucket

func (c *ObsObj) OpenBucket(bucketName string) (err error)

func (*ObsObj) PutObjectFromFile

func (c *ObsObj) PutObjectFromFile(bucketName, objectName, localFileName string, args ...string) string

func (*ObsObj) UploadString

func (c *ObsObj) UploadString(bucketName, objectName string, args ...string) string

type UpyunConfigOption

type UpyunConfigOption struct {
	Bucket   string
	Operator string
	Password string
	Domain   string
}

又拍云配置

Jump to

Keyboard shortcuts

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