Documentation
¶
Index ¶
- Variables
- func NewResty() *resty.Request
- func RestyStringBody(rsp *resty.Response) string
- type Cos
- type Downloader
- type File
- func NewCosFile(filename string, cos Cos) File
- func NewFile(fileType FileType, filename string, storage interface{}, ...) File
- func NewFtpFile(filename string, ftp Ftp) File
- func NewHttpFile(filename string, url string, method gox.HttpMethod) File
- func NewLocal(filename string) File
- func NewOssFile(filename string, oss Oss) File
- type FileType
- type Ftp
- type Http
- type Local
- type Oss
- type Transfer
- type Uploader
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorNotSupportStorage 不支持的存储类型 ErrorNotSupportStorage = &gox.CodeError{ErrorCode: 100, Message: "不支持的存储类型"} // ErrorDownload 文件下载失败 ErrorDownload = &gox.CodeError{ErrorCode: 101, Message: "文件下载失败"} // ErrorUpload 文件上传失败 ErrorUpload = &gox.CodeError{ErrorCode: 102, Message: "文件上传失败"} )
Functions ¶
func RestyStringBody ¶ added in v1.0.3
RestyStringBody 字符串形式的结果
Types ¶
type Cos ¶
type Cos struct {
// 通信地址
Url string
// 基础路径
Base string
// 授权,相当于用户名
SecretId string
// 授权,相当于密码
SecretKey string
// 临时密钥
Token string
// 分隔符
Separator string `default:"/"`
}
Cos 腾讯云对象存储
type Downloader ¶ added in v1.0.3
type Downloader interface {
// Download 下载文件
Download(srcFilename string, destFilename string) (err error)
}
Downloader 下载
type File ¶ added in v0.0.3
type File struct {
// Type 类型
Type FileType `json:"type" validate:"required,oneof=http oss cos ftp local"`
// Filename 文件名
Filename string `json:"filename" validate:"required"`
// Checksum 文件校验
Checksum gox.Checksum `json:"checksum" validate:"omitempty,structonly"`
// Storage 存储
Storage interface{} `json:"storage"`
}
File 文件
func NewCosFile ¶ added in v1.0.7
NewCosFile 创建一个腾讯云对象存储文件
func NewFtpFile ¶ added in v1.0.4
NewFtpFile 创建一个Ftp类型的文件
func NewHttpFile ¶ added in v1.0.3
func NewHttpFile(filename string, url string, method gox.HttpMethod) File
NewHttpFile 创建Http存储文件
func NewOssFile ¶ added in v1.0.7
NewOssFile 创建一个阿里云对象存储文件
func (*File) UnmarshalJSON ¶ added in v1.0.3
type Ftp ¶
type Ftp struct {
// 地址
Addr string `json:"addr" validate:"required"`
// 用户名
Username string `json:"username" validate:"required"`
// 密码
Password string `json:"password" validate:"required"`
// contains filtered or unexported fields
}
Ftp Ftp存储
type Http ¶ added in v1.0.3
type Http struct {
// 访问地址
Url string `json:"url"`
// 方法
Method gox.HttpMethod `json:"method"`
}
Http Http存储
type Local ¶ added in v1.1.1
type Local struct{}
Local 本地文件
Click to show internal directories.
Click to hide internal directories.