Documentation ¶
Index ¶
- Constants
- func NewStorage(ossName string, config Config) error
- type AliYun
- func (aliYun *AliYun) DeleteObject(objectKey string) error
- func (aliYun *AliYun) GetObjectToFile(objectKey, filePath string) error
- func (aliYun *AliYun) GetObjectUrl(objectKey string) string
- func (aliYun *AliYun) IsExists(objectKey string) (bool, error)
- func (aliYun *AliYun) PutObject(objectKey string, reader io.Reader) error
- func (aliYun *AliYun) PutObjectFromFile(objectKey, filePath string) error
- type Config
- type Minio
- func (mini *Minio) DeleteObject(objectKey string) error
- func (mini *Minio) GetObjectToFile(objectKey, filePath string) error
- func (mini *Minio) GetObjectUrl(objectKey string) string
- func (mini *Minio) IsExists(objectKey string) (bool, error)
- func (mini *Minio) PutObject(objectKey string, reader io.Reader) error
- func (mini *Minio) PutObjectFromFile(objectKey, filePath string) error
- type QiNiu
- func (q *QiNiu) DeleteObject(objectKey string) error
- func (q *QiNiu) GetObjectToFile(objectKey, filePath string) error
- func (q *QiNiu) GetObjectUrl(objectKey string) string
- func (q *QiNiu) IsExists(objectKey string) (bool, error)
- func (q *QiNiu) PutObject(objectKey string, reader io.Reader) error
- func (q *QiNiu) PutObjectFromFile(objectKey, filePath string) error
- type Storage
- type Tencent
- func (t *Tencent) DeleteObject(objectKey string) error
- func (t *Tencent) GetObjectToFile(objectKey, filePath string) error
- func (t *Tencent) GetObjectUrl(objectKey string) string
- func (t *Tencent) IsExists(objectKey string) (bool, error)
- func (t *Tencent) PutObject(objectKey string, reader io.Reader) error
- func (t *Tencent) PutObjectFromFile(objectKey, filePath string) error
Constants ¶
View Source
const ( AliYunConst = "aliYun" TencentConst = "tencent" QinNiuConst = "qiNiu" MinioConst = "minio" )
View Source
const (
TempFileSuffix = ".temp" // Temp file suffix
)
Variables ¶
This section is empty.
Functions ¶
func NewStorage ¶
Types ¶
type AliYun ¶
type AliYun struct {
// contains filtered or unexported fields
}
func (*AliYun) DeleteObject ¶
DeleteObject 删除文件
func (*AliYun) GetObjectToFile ¶
GetObjectToFile 获取文件
func (*AliYun) GetObjectUrl ¶
GetObjectUrl 获取访问URL
func (*AliYun) PutObjectFromFile ¶
type Config ¶
type Config struct { // (必填,对应阿里云access_key_id、腾讯云secret_id,七牛云accessKey) KeyId string // (必填,对应阿里云access_key_secret、腾讯云secret_key,七牛云secretKey) KeySecret string Bucket string // 阿里云必填 Endpoint string // 腾讯云必填 AppId string // 腾讯云必填 Region string // 域名 Domain string // 是否私有 (仅七牛云) Private bool // 是否使用Https(Minio) UseSSL bool }
type Minio ¶ added in v1.0.3
type Minio struct {
// contains filtered or unexported fields
}
func (*Minio) DeleteObject ¶ added in v1.0.3
DeleteObject 删除文件
func (*Minio) GetObjectToFile ¶ added in v1.0.3
GetObjectToFile 获取文件
func (*Minio) GetObjectUrl ¶ added in v1.0.3
GetObjectUrl 获取访问URL
func (*Minio) PutObjectFromFile ¶ added in v1.0.3
type QiNiu ¶
type QiNiu struct {
// contains filtered or unexported fields
}
func (*QiNiu) GetObjectToFile ¶
GetObjectToFile 获取文件
func (*QiNiu) GetObjectUrl ¶
GetObjectUrl 获取访问URL
func (*QiNiu) PutObjectFromFile ¶
type Storage ¶
type Storage interface { GetObjectToFile(objectKey, downloadedFileName string) error DeleteObject(objectKey string) error PutObject(objectKey string, reader io.Reader) error PutObjectFromFile(objectKey, filePath string) error IsExists(objectKey string) (bool, error) GetObjectUrl(objectKey string) string }
func GetStorage ¶
type Tencent ¶
type Tencent struct {
// contains filtered or unexported fields
}
func NewTencent ¶ added in v1.0.3
func (*Tencent) GetObjectToFile ¶
获取文件
func (*Tencent) GetObjectUrl ¶
GetObjectUrl 获取访问URL
func (*Tencent) PutObjectFromFile ¶
PutObjectFromFile 上传文件
Click to show internal directories.
Click to hide internal directories.