file

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	log.Log
	// contains filtered or unexported fields
}

File 文件操作

func New

func New(ctx *config.Context) *File

New New

func (*File) Route

func (f *File) Route(r *wkhttp.WKHttp)

Route 路由

type IService

type IService interface {
	IUploadService
	DownloadAndMakeCompose(uploadPath string, downloadURLs []string) (map[string]interface{}, error)
	DownloadImage(url string, ctx context.Context) (io.ReadCloser, error)
}

IService IService

func NewService

func NewService(ctx *config.Context) IService

NewService NewService

type IUploadService

type IUploadService interface {
	UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)
	// 获取下载地址
	DownloadURL(path string, filename string) (string, error)
}

type SeaweedFS

type SeaweedFS struct {
	log.Log
	// contains filtered or unexported fields
}

func NewSeaweedFS

func NewSeaweedFS(ctx *config.Context) *SeaweedFS

func (*SeaweedFS) DownloadURL

func (s *SeaweedFS) DownloadURL(path string, filename string) (string, error)

func (*SeaweedFS) UploadFile

func (s *SeaweedFS) UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)

UploadFile 上传文件

type Service

type Service struct {
	log.Log
	// contains filtered or unexported fields
}

Service Service

func (*Service) DownloadAndMakeCompose

func (s *Service) DownloadAndMakeCompose(uploadPath string, downloadURLs []string) (map[string]interface{}, error)

DownloadAndMakeCompose 下载并组合图片

func (*Service) DownloadImage

func (s *Service) DownloadImage(url string, ctx context.Context) (io.ReadCloser, error)

func (*Service) DownloadURL

func (s *Service) DownloadURL(path string, filename string) (string, error)

func (*Service) MakeCompose

func (s *Service) MakeCompose(srcImgFiles []io.ReadCloser) (image.Image, error)

MakeCompose 组合图片

func (*Service) UploadFile

func (s *Service) UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)

type ServiceMinio

type ServiceMinio struct {
	log.Log
	// contains filtered or unexported fields
}

ServiceMinio 文件上传

func NewServiceMinio

func NewServiceMinio(ctx *config.Context) *ServiceMinio

NewServiceMinio NewServiceMinio

func (*ServiceMinio) DownloadURL

func (sm *ServiceMinio) DownloadURL(ph string, filename string) (string, error)

func (*ServiceMinio) UploadFile

func (sm *ServiceMinio) UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)

UploadFile 上传文件

type ServiceOSS

type ServiceOSS struct {
	log.Log
	// contains filtered or unexported fields
}

func NewServiceOSS

func NewServiceOSS(ctx *config.Context) *ServiceOSS

NewServiceOSS NewServiceOSS

func (*ServiceOSS) DownloadURL

func (s *ServiceOSS) DownloadURL(path string, filename string) (string, error)

func (*ServiceOSS) UploadFile

func (s *ServiceOSS) UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)

UploadFile 上传文件

type ServiceQiniu

type ServiceQiniu struct {
	log.Log
	// contains filtered or unexported fields
}

func NewServiceQiniu

func NewServiceQiniu(ctx *config.Context) *ServiceQiniu

NewServiceQiniu NewServiceQiniu

func (*ServiceQiniu) DownloadURL

func (s *ServiceQiniu) DownloadURL(path string, filename string) (string, error)

func (*ServiceQiniu) UploadFile

func (s *ServiceQiniu) UploadFile(filePath string, contentType string, copyFileWriter func(io.Writer) error) (map[string]interface{}, error)

UploadFile 上传文件

type Type

type Type string

Type 文件类型

const (
	// TypeChat 聊天文件
	TypeChat Type = "chat"
	// TypeMoment 动态文件
	TypeMoment Type = "moment"
	// TypeMomentCover 动态封面
	TypeMomentCover Type = "momentcover"
	// TypeSticker 表情
	TypeSticker Type = "sticker"
	// TypeReport 举报
	TypeReport Type = "report"
	// TypeCommon 通用
	TypeCommon Type = "common"
	// TypeChatBg 聊天背景
	TypeChatBg Type = "chatbg"
	// TypeDownload 下载文件目录
	TypeDownload = "download"
	// TypeWorkplaceBanner
	TypeWorkplaceBanner Type = "workplacebanner"
	// TypeWorkplaceAppIcon
	TypeWorkplaceAppIcon Type = "workplaceappicon"
)

Jump to

Keyboard shortcuts

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