oss

package
v0.0.0-...-03884a7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileNameWithDateTime

func NewFileNameWithDateTime(filename string) string

Types

type Aliyun

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

func NewAliyunOSS

func NewAliyunOSS(cfg *Config) *Aliyun

func (*Aliyun) DeleteFile

func (s *Aliyun) DeleteFile(filepath string) (err error)

func (*Aliyun) ListFiles

func (s *Aliyun) ListFiles(prefix string, limit int) (files []*FileInfo, err error)

func (*Aliyun) UploadFile

func (s *Aliyun) UploadFile(f io.Reader, prefix string, filename string) (filepath string, err error)

type Config

type Config 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"`
}

type FileInfo

type FileInfo struct {
	IsDir    bool   `json:"is_dir"`    // 是否是目录
	FilePath string `json:"file_path"` // 文件路径
	FileName string `json:"file_name"` // 文件名
	FileType string `json:"file_type"` // 文件类型
	FileSize int64  `json:"file_size"` // 文件大小
	FileUrl  string `json:"file_url"`  // 文件访问地址
	UpTime   int64  `json:"up_time"`   // 上传时间
}

type Local

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

func NewLocal

func NewLocal(cfg *Config) *Local

func (*Local) DeleteFile

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

func (*Local) ListFiles

func (s *Local) ListFiles(prefix string, limit int) (files []*FileInfo, err error)

func (*Local) UploadFile

func (s *Local) UploadFile(f io.Reader, prefix string, filename string) (filepath string, err error)

type OSS

type OSS interface {
	// return BucketUrl+BasePath+prefix+filename
	UploadFile(f io.Reader, prefix string, filename string) (filepath string, err error)
	DeleteFile(filepath string) error
	ListFiles(prefix string, limit int) (files []*FileInfo, err error)
}

OSS(Object Storage Service,对象存储服务)

type Qiniu

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

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

func NewQiniu

func NewQiniu(conf *Config) *Qiniu

func (*Qiniu) DeleteFile

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

func (*Qiniu) ListFiles

func (s *Qiniu) ListFiles(prefix string, limit int) (files []*FileInfo, err error)

func (*Qiniu) UploadFile

func (s *Qiniu) UploadFile(f io.Reader, prefix string, filename string) (filepath string, err error)

Jump to

Keyboard shortcuts

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