upload

package
v0.0.0-...-6b90055 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunOSS

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

func NewAliyunOSS

func NewAliyunOSS(cfg *UploadConfig) *AliyunOSS

func (*AliyunOSS) DeleteFile

func (s *AliyunOSS) DeleteFile(key string) (err error)

func (*AliyunOSS) UploadFile

func (s *AliyunOSS) UploadFile(prefix string, file *multipart.FileHeader) (url string, err error)

type Local

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

func NewLocal

func NewLocal(cfg *UploadConfig) *Local

func (*Local) DeleteFile

func (s *Local) DeleteFile(key string) error

func (*Local) UploadFile

func (s *Local) UploadFile(prefix string, file *multipart.FileHeader) (url string, err error)

type Qiniu

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

https://developer.qiniu.com/kodo/1238/go

func NewQiniu

func NewQiniu(conf *UploadConfig) *Qiniu

func (*Qiniu) DeleteFile

func (s *Qiniu) DeleteFile(key string) error

func (*Qiniu) UploadFile

func (s *Qiniu) UploadFile(prefix string, file *multipart.FileHeader) (url string, err error)

type UploadConfig

type UploadConfig struct {
	Zone            string `json:"zone"`
	Endpoint        string `json:"endpoint"`
	AccessKeyId     string `json:"access-key-id"`
	AccessKeySecret string `json:"access-key-secret"`
	BucketName      string `json:"bucket-name"`
	BucketUrl       string `json:"bucket-url"`
	BasePath        string `json:"base-path"`
	FileNameAsKey   func(file *multipart.FileHeader) string
}

type Uploader

type Uploader interface {
	UploadFile(prefix string, file *multipart.FileHeader) (string, error)
	DeleteFile(key string) error
}

Uploader 对象存储接口

Jump to

Keyboard shortcuts

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