Documentation
¶
Index ¶
- type FileData
- type IStoreClient
- type ResultData
- type StoreClient
- func (c *StoreClient) Complete(id string, data []byte, hf func(string) string) (path string, err error)
- func (c *StoreClient) Continue(id string, data []byte) (err error)
- func (c *StoreClient) Delete(path string) (ok bool, err error)
- func (c *StoreClient) GetFilePath(fileName string) string
- func (c *StoreClient) Start(extName string, data []byte, ttl int64) (id string, err error)
- func (c *StoreClient) Upload(extName string, data []byte) (newFilePath string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileData ¶
type FileData struct { Domain string `json:"domain"` // 域名 Md5 string `json:"md5"` // md5 Mtime int64 `json:"mtime"` // 时间戳秒 Path string `json:"path"` // 路径 Retcode int `json:"retcode"` // 响应码 Retmsg string `json:"retmsg"` // 响应内容 Scene string `json:"scene"` // 上传到的场景 Scenes string `json:"scenes"` // 支持的场景 Size int `json:"size"` // 文件大小 Src string `json:"src"` // 文件地址 Url string `json:"url"` // 文件访问地址 }
FileData 文件信息
type IStoreClient ¶
type IStoreClient interface { //Start 开始文件上传[本地缓存] //extName 文件扩展名【不带. 如 jpg mp3】 //data 文件数据块【不可为空】 //ttl 应用程序缓存时间[秒] //id 返回的索引 //error 数据或扩展名不对时 Start(extName string, data []byte, ttl int64) (id string, err error) //Continue 继续 //id 开始返回的索引 //data 文件数据块【不可为空】 //error 本地无缓存或缓存失效时 Continue(id string, data []byte) (err error) //Complete 完成 //id 开始返回的索引 //data 文件数据块【可为空】 //error 本地无缓存或缓存失效时 Complete(id string, data []byte, hf func(string) string) (path string, err error) //Upload 文件上传 //extName 文件扩展名【不带. 如 jpg mp3】 //data 完整数据 //path 返回 文件路径 Upload(extName string, data []byte) (path string, err error) //Delete 文件删除 //path 文件路径 //ok 是否删除成功 Delete(path string) (ok bool, err error) }
IStoreClient 文件存储客户端
func GetStoreClient ¶ added in v1.6.16
func GetStoreClient(mappingName string, configFn func(mappingName string) map[string]string) IStoreClient
GetStoreClient 获取文件上传客户端
type ResultData ¶
type ResultData struct { Data FileData `json:"data"` //数据 Message string `json:"message"` //消息 Status string `json:"status"` //状态 }
ResultData 请求结果数据
type StoreClient ¶
type StoreClient struct {
// contains filtered or unexported fields
}
StoreClient 文件上传客户端
func (*StoreClient) Complete ¶ added in v1.6.3
func (c *StoreClient) Complete(id string, data []byte, hf func(string) string) (path string, err error)
Complete id 开始返回的索引 file 文件数据块【可为空】 index 文件段序号(传小于0内部默认按插入顺序从0开始)序号一样会覆盖 error 本地无缓存或缓存失效时 hf (完整文件数据,上传的包) (要保存的数据,是否现在保存:false不保存待后续数据 true立刻保存) 【可为空】
func (*StoreClient) Continue ¶ added in v1.6.3
func (c *StoreClient) Continue(id string, data []byte) (err error)
Continue id 开始返回的索引 file 文件数据块【不可为空】 index 文件段序号(传小于0内部默认按插入顺序从0开始)序号一样会覆盖 error 本地无缓存或缓存失效时
func (*StoreClient) Delete ¶
func (c *StoreClient) Delete(path string) (ok bool, err error)
Delete 文件删除
func (*StoreClient) GetFilePath ¶ added in v1.6.16
func (c *StoreClient) GetFilePath(fileName string) string
GetFilePath 文件路径
Click to show internal directories.
Click to hide internal directories.