storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2017 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(key string) (string, error)

func GenerateDownloadURL

func GenerateDownloadURL(key string) string

func InitStorage

func InitStorage(storageType string, config *Config)

func Upload

func Upload(key, filePath string) (string, error)

Types

type Config

type Config struct {
	DownloadURL string

	LocalStoragePath string

	AccessKey string
	SecretKey string
	Bucket    string
	Prefix    string

	QiNiuZone int

	OSSEndpoint string
}

type Local

type Local struct {
	Config *Config
}

func NewLocal

func NewLocal(config *Config) *Local

func (*Local) Download

func (self *Local) Download(key string) (string, error)

func (*Local) GenerateDownloadURL

func (self *Local) GenerateDownloadURL(key string) string

func (*Local) Upload

func (self *Local) Upload(key, filePath string) (string, error)

type OSS

type OSS struct {
	Config *Config
	Bucket *oss.Bucket
}

func NewOSS

func NewOSS(config *Config) *OSS

func (*OSS) Download

func (self *OSS) Download(key string) (string, error)

func (*OSS) GenerateDownloadURL

func (self *OSS) GenerateDownloadURL(key string) string

func (*OSS) Upload

func (self *OSS) Upload(key, filePath string) (string, error)

type QiNiu

type QiNiu struct {
	Config *Config
	Bucket kodo.Bucket
}

func NewQiNiu

func NewQiNiu(config *Config) *QiNiu

func (*QiNiu) Download

func (self *QiNiu) Download(key string) (string, error)

func (*QiNiu) GenerateDownloadURL

func (self *QiNiu) GenerateDownloadURL(key string) string

func (*QiNiu) Upload

func (self *QiNiu) Upload(key, filePath string) (string, error)

type Storage

type Storage interface {
	Upload(key, filePath string) (string, error)

	Download(key string) (string, error)

	GenerateDownloadURL(key string) string
}

Jump to

Keyboard shortcuts

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