storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS = "success"
	FAIL    = "fail"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseInterface

type BaseInterface interface {

	/**
	  从本地路径读取文件并保存
	  srcPath 本地文件路径
	  dstAbsPath 目的位置绝对路径
	  dstRelativePath 目的位置相对路径
	*/
	SaveFileFromLocalPath(srcPath string, dstAbsPath, dstRelativePath string) (url string, err error)

	/**
	  将本地文件保存到目标位置
	  srcFile 源文件读取接口
	  dstAbsPath 目的位置绝对路径
	  dstRelativePath 目的位置相对路径
	*/
	SaveFile(srcFile io.Reader, srcFileSize int64, dstAbsPath, dstRelativePath string) (url string, err error)

	/**
	  将数据保存到目标位置
	  data 数据
	  dstAbsPath 目的位置绝对路径
	  dstRelativePath 目的位置相对路径
	*/
	SaveData(data []byte, dstAbsPath, dstRelativePath string) (url string, err error)
}

type LocalFile

type LocalFile struct {
	BaseInterface
}

func (*LocalFile) SaveData

func (lf *LocalFile) SaveData(data []byte, dstAbsPath, dstRelativePath string) (url string, err error)

* 保存数据到本地

func (*LocalFile) SaveFile

func (lf *LocalFile) SaveFile(srcFile io.Reader, srcFileSize int64, dstAbsPath, dstRelativePath string) (url string, err error)

* 保存文件到本地

func (*LocalFile) SaveFileFromLocalPath

func (lf *LocalFile) SaveFileFromLocalPath(srcPath string, dstAbsPath, dstRelativePath string) (url string, err error)

type Qiniu

type Qiniu struct {
	BaseInterface
	// contains filtered or unexported fields
}

func NewQiniu

func NewQiniu(config *QiniuConfig) *Qiniu

func (*Qiniu) SaveData

func (qn *Qiniu) SaveData(data []byte, dstAbsPath, dstRelativePath string) (url string, err error)

func (*Qiniu) SaveFile

func (qn *Qiniu) SaveFile(srcFile io.Reader, srcFileSize int64, dstAbsPath, dstRelativePath string) (url string, err error)

func (*Qiniu) SaveFileFromLocalPath

func (qn *Qiniu) SaveFileFromLocalPath(srcPath string, dstAbsPath, dstRelativePath string) (url string, err error)

* 从本地文件保存

type QiniuConfig

type QiniuConfig struct {
	AccessKey     string
	SecretKey     string
	Bucket        string
	PolicyExpires uint32              // 上传凭证的有效时间,单位秒
	Zone          *qiniu_storage.Zone // 空间所在的机房
	UseHTTPS      bool                // 是否使用https域名
	UseCdnDomains bool                // 是否使用cdn加速域名
	CentralRsHost string              // 中心机房的RsHost,用于list bucket
	Domain        string              // 外链域名
}

type QiniuRet

type QiniuRet struct {
	Key    string
	Hash   string
	Fsize  int
	Bucket string
}

Jump to

Keyboard shortcuts

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