disk

package
v0.0.0-...-7c51b95 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const QiNiuDisk = `qiniu`

Variables

This section is empty.

Functions

func NewQiNiu

func NewQiNiu(config *QiNiuConfiguration) contract.Storage

一个新的bucket是一个新的Server

Types

type QiNiu

type QiNiu struct {
	// contains filtered or unexported fields
}

func (QiNiu) Bucket

func (q QiNiu) Bucket() *storage.BucketManager

桶对象

func (QiNiu) Callback

func (q QiNiu) Callback(req *http.Request) (*contract.StorageInfo, error)

客户端上传成功后的异步回调 TODO: 此功能需要测试

func (QiNiu) FormUpload

func (q QiNiu) FormUpload(ctx context.Context, metadata *contract.StorageMetadata) (*contract.StorageInfo, error)

简单表单上传

func (QiNiu) PartUpload

func (q QiNiu) PartUpload(ctx context.Context, metadata *contract.StorageMetadata, notify contract.Notify) (*contract.StorageInfo, error)

分块上传

func (QiNiu) Token

func (q QiNiu) Token() string

返回临时的一次性令牌

func (QiNiu) Url

func (q QiNiu) Url(key string, params url2.Values) string

获取资源访问URL

type QiNiuConfiguration

type QiNiuConfiguration struct {
	AccessKey string `json:"access_key" yaml:"access_key" mapstructure:"access_key"`
	SecretKey string `json:"secret_key" yaml:"secret_key" mapstructure:"secret_key"`
	Bucket    string `json:"bucket" yaml:"bucket"`
	IsPrivate bool   `json:"is_private" yaml:"is_private" mapstructure:"is_private"`
	Region    string `json:"region" yaml:"region"` // z0:Huadong z1:Huabei z2:Huanan na0:NorthAmerica as0:Singapore
	Domain    string `json:"domain" yaml:"domain"`
	Expires   uint64 `json:"expires" yaml:"expires"` // 资源公开有效期,单位:s
	UseHttps  bool   `json:"use_https" yaml:"use_https" mapstructure:"use_https"`
	UseCdn    bool   `json:"use_cdn" yaml"use_cdn" mapstructure:"use_cdn"`
	NotifyUrl string `json:"notify_url" yaml:"notify_url" mapstructure:"notify_url"`
}

type ReturnResult

type ReturnResult struct {
	Hash         string `json:"hash"`
	PersistentID string `json:"persistent_id"`
	Key          string `json:"key"`
	OriginalName string `json:"original_name"`
	Ext          string `json:"ext"`
	Bucket       string `json:"bucket"`
	ImageInfo    struct {
		Width  int `json:"width"`
		Height int `json:"height"`
	} `json:"image_info"`
	Exif     map[string]interface{} `json:"exif"`
	AvInfo   map[string]interface{} `json:"avinfo"`
	MimeType string                 `json:"mime_type"`
	Size     int                    `json:"size"`
}

Jump to

Keyboard shortcuts

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