storage

package
v0.0.0-...-49cc056 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CosUploader

type CosUploader struct {
	*cos.Client
	// contains filtered or unexported fields
}

func NewCosUploader

func NewCosUploader(config map[string]string) *CosUploader

func (*CosUploader) Content

func (s *CosUploader) Content(name string) ([]byte, error)

func (*CosUploader) Exists

func (s *CosUploader) Exists(name string) (bool, error)

func (*CosUploader) GetEngineName

func (s *CosUploader) GetEngineName() string

func (*CosUploader) GetFullUrl

func (s *CosUploader) GetFullUrl(name string) string

func (*CosUploader) List

func (s *CosUploader) List(dir string) ([]File, error)

func (*CosUploader) Mkdir

func (s *CosUploader) Mkdir(dir string) error

func (*CosUploader) Remove

func (s *CosUploader) Remove(name string) error

func (*CosUploader) Rename

func (s *CosUploader) Rename(oldname, newname string) error

func (*CosUploader) Rmdir

func (s *CosUploader) Rmdir(dir string) error

func (*CosUploader) Upload

func (s *CosUploader) Upload(storageName string, LocalFile io.Reader) (string, error)

Upload 上传图片 storageName 云端路径名. 最终上传相对urlPrefix生成地址 LocalFile 要上传的文件名

type File

type File struct {
	Id       string    `json:"id"`
	FullPath string    `json:"full_path"`
	Name     string    `json:"name"`
	Size     int64     `json:"size"`
	Ctime    time.Time `json:"ctime"`
	IsDir    bool      `json:"is_dir"`
}

type FileUploader

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

func NewFileUploader

func NewFileUploader(opt map[string]string) *FileUploader

func (*FileUploader) Content

func (s *FileUploader) Content(name string) ([]byte, error)

func (*FileUploader) Exists

func (s *FileUploader) Exists(name string) (bool, error)

func (*FileUploader) GetEngineName

func (s *FileUploader) GetEngineName() string

func (*FileUploader) GetFullUrl

func (s *FileUploader) GetFullUrl(name string) string

func (*FileUploader) List

func (s *FileUploader) List(dir string) ([]File, error)

func (*FileUploader) Mkdir

func (s *FileUploader) Mkdir(dir string) error

func (*FileUploader) Remove

func (s *FileUploader) Remove(name string) error

func (*FileUploader) Rename

func (s *FileUploader) Rename(oldname, newname string) error

func (*FileUploader) Rmdir

func (s *FileUploader) Rmdir(dir string) error

func (*FileUploader) Upload

func (s *FileUploader) Upload(storageName string, LocalFile io.Reader) (string, error)

type FtpUploader

type FtpUploader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFtpUploader

func NewFtpUploader(opt map[string]string) *FtpUploader

func (*FtpUploader) Content

func (s *FtpUploader) Content(name string) ([]byte, error)

func (*FtpUploader) Exists

func (s *FtpUploader) Exists(name string) (bool, error)

func (*FtpUploader) GetEngineName

func (s *FtpUploader) GetEngineName() string

func (*FtpUploader) GetFullUrl

func (s *FtpUploader) GetFullUrl(name string) string

func (*FtpUploader) List

func (s *FtpUploader) List(dir string) ([]File, error)

func (*FtpUploader) Mkdir

func (s *FtpUploader) Mkdir(dir string) (err error)

func (*FtpUploader) Remove

func (s *FtpUploader) Remove(name string) error

func (*FtpUploader) Rename

func (s *FtpUploader) Rename(oldname, newname string) error

func (*FtpUploader) Rmdir

func (s *FtpUploader) Rmdir(dir string) error

func (*FtpUploader) Upload

func (s *FtpUploader) Upload(storageName string, LocalFile io.Reader) (string, error)

type OssUploader

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

func NewOssUploader

func NewOssUploader(config map[string]string) *OssUploader

func (*OssUploader) Content

func (s *OssUploader) Content(name string) ([]byte, error)

func (*OssUploader) Exists

func (s *OssUploader) Exists(name string) (bool, error)

func (*OssUploader) GetEngineName

func (s *OssUploader) GetEngineName() string

func (*OssUploader) GetFullUrl

func (s *OssUploader) GetFullUrl(name string) string

func (*OssUploader) List

func (s *OssUploader) List(dir string) ([]File, error)

func (*OssUploader) Mkdir

func (s *OssUploader) Mkdir(dir string) error

func (*OssUploader) Remove

func (s *OssUploader) Remove(name string) error

func (*OssUploader) Rename

func (s *OssUploader) Rename(oldname, newname string) error

func (*OssUploader) Rmdir

func (s *OssUploader) Rmdir(dir string) error

func (*OssUploader) Upload

func (s *OssUploader) Upload(storageName string, LocalFile io.Reader) (string, error)

Upload 上传图片 storageName 云端路径名. 最终上传相对urlPrefix生成地址 LocalFile 要上传的文件名

type Uploader

type Uploader interface {
	Upload(storageName string, LocalFile io.Reader) (string, error)
	List(dir string) (list []File, err error)
	Exists(name string) (bool, error)
	GetFullUrl(name string) string
	Remove(name string) error
	GetEngineName() string
	Content(string) ([]byte, error)
	Rename(string, string) error
	Mkdir(string) error
	Rmdir(string) error
}

Jump to

Keyboard shortcuts

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