CloudStorage

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunOSS added in v1.0.4

type AliyunOSS struct {
	Endpoint        string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	AccessKeyId     string `mapstructure:"access-key-id" json:"accessKeyId" yaml:"access-key-id"`
	AccessKeySecret string `mapstructure:"access-key-secret" json:"accessKeySecret" yaml:"access-key-secret"`
	BucketName      string `mapstructure:"bucket-name" json:"bucketName" yaml:"bucket-name"`
	BucketUrl       string `mapstructure:"bucket-url" json:"bucketUrl" yaml:"bucket-url"`
}

type Local

type Local struct {
	Path string `mapstructure:"path" json:"path" yaml:"path"` // 本地文件路径
}

type LocalUpload added in v1.0.4

type LocalUpload struct {
	Config Local
}

func (*LocalUpload) DeleteFile added in v1.0.4

func (l *LocalUpload) DeleteFile(key string) error

func (*LocalUpload) UploadFile added in v1.0.4

func (l *LocalUpload) UploadFile(file *multipart.FileHeader) (Path, FileName string, err error)

@author: [wulala](https://github.com/water-gulugulu) @object: *LocalUpload @function: UploadFile @description: 上传文件 @param: file *multipart.FileHeader @return: Path string @return: FileName string @return: err error

type OSS added in v1.0.4

type OSS interface {
	UploadFile(file *multipart.FileHeader) (path, filename string, err error)
	DeleteFile(key string) error
}

type OssConfig added in v1.0.4

type OssConfig struct {
	Type   string      // 类型 local-本地 tencent-腾讯云 aliyun-阿里云 qiniu-七牛云
	Config interface{} // 类型 根据type断言对应的类型
}

func (*OssConfig) NewOSS added in v1.0.4

func (c *OssConfig) NewOSS() OSS

type Qiniu added in v1.0.4

type Qiniu struct {
	Zone          string `mapstructure:"zone" json:"zone" yaml:"zone"`                                // 存储区域
	Bucket        string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`                          // 空间名称
	ImgPath       string `mapstructure:"img-path" json:"imgPath" yaml:"img-path"`                     // CDN加速域名
	UseHTTPS      bool   `mapstructure:"use-https" json:"useHttps" yaml:"use-https"`                  // 是否使用https
	AccessKey     string `mapstructure:"access-key" json:"accessKey" yaml:"access-key"`               // accessKey
	SecretKey     string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`               // secretKey
	UseCdnDomains bool   `mapstructure:"use-cdn-domains" json:"useCdnDomains" yaml:"use-cdn-domains"` // 上传是否使用CDN上传加速
}

type TencentCOS

type TencentCOS struct {
	Bucket     string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
	Region     string `mapstructure:"region" json:"region" yaml:"region"`
	SecretID   string `mapstructure:"secret-id" json:"secretID" yaml:"secret-id"`
	SecretKey  string `mapstructure:"secret-key" json:"secretKey" yaml:"secret-key"`
	BaseURL    string `mapstructure:"base-url" json:"baseURL" yaml:"base-url"`
	PathPrefix string `mapstructure:"path-prefix" json:"pathPrefix" yaml:"path-prefix"`
}

type TencentCos added in v1.0.4

type TencentCos struct {
	Config TencentCOS
}

func (TencentCos) DeleteFile added in v1.0.4

func (t TencentCos) DeleteFile(key string) error

func (TencentCos) UploadFile added in v1.0.4

func (t TencentCos) UploadFile(file *multipart.FileHeader) (path, filename string, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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