services

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

* @Descripttion: * @version: * @Author: lfzxs@qq.com * @Date: 2023-08-22 11:42:54 * @LastEditors: lfzxs@qq.com * @LastEditTime: 2023-08-24 10:25:01

* @Descripttion: * @version: * @Author: lfzxs@qq.com * @Date: 2023-08-24 09:51:07 * @LastEditors: lfzxs@qq.com * @LastEditTime: 2023-09-14 16:57:12

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaiduOss

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

func (*BaiduOss) FileHash

func (obj *BaiduOss) FileHash(filedata io.Reader) (hash string, err error)

func (*BaiduOss) GetFileKeyFormHash

func (obj *BaiduOss) GetFileKeyFormHash(hash string) (fileKey string, err error)

func (*BaiduOss) GetName

func (obj *BaiduOss) GetName() string

func (*BaiduOss) LinkFile

func (obj *BaiduOss) LinkFile(path string, fileKey string) (objectKey string, err error)

func (*BaiduOss) SaveFile

func (obj *BaiduOss) SaveFile(filedata io.Reader, size int64, path string, pairs ...Pair) (fileUrl string, fileKey string, err error)

func (*BaiduOss) SetName

func (obj *BaiduOss) SetName(name string)

type BeyondService

type BeyondService struct {
	ConnStr string
	// contains filtered or unexported fields
}

func NewBeyond

func NewBeyond(name string, connStr string) (*BeyondService, error)

func (*BeyondService) FileHash

func (obj *BeyondService) FileHash(filedata io.Reader) (hash string, err error)

func (*BeyondService) GetFileKeyFormHash

func (obj *BeyondService) GetFileKeyFormHash(hash string) (fileKey string, err error)

func (*BeyondService) GetName

func (obj *BeyondService) GetName() string

func (*BeyondService) LinkFile

func (obj *BeyondService) LinkFile(path string, fileKey string) (objectKey string, err error)

func (*BeyondService) SaveFile

func (obj *BeyondService) SaveFile(filedata io.Reader, size int64, path string, pairs ...Pair) (fileUrl string, fileKey string, err error)

func (*BeyondService) SetName

func (obj *BeyondService) SetName(name string)

type IUpLoad

type IUpLoad interface {
	GetName() string

	/**
	* FileHash
	* @Description: 获取文件hash值
	* @param filedata 文件流
	* @return hash 文件hash值
	* @return err 异常(文件流异常)
	 */
	FileHash(filedata io.Reader) (hash string, err error)

	/**
	* FileHash
	* @Description: 获取文件hash值
	* @param filedata 文件流
	* @return hash 文件hash值
	* @return err 异常(文件流异常)
	 */
	GetFileKeyFormHash(hash string) (fileKey string, err error)

	/**
	* SaveFile
	* @Description: 保存文件
	* @param filedata 文件流
	* @param size 文件大小,单位字节
	* @param path 保存路径
	* @param pairs 其他属性
	* @return fileUrl 文件访问路径
	* @return objectKey 文件对象ID
	* @return err 异常
	 */
	SaveFile(filedata io.Reader, size int64, path string, pairs ...Pair) (fileUrl string, fileKey string, err error)

	/**
	* LinkFile
	* @Description: 创建链接文件
	* @param path 逻辑路径
	* @param fileKey 文件对象ID
	* @return objectKey 链接文件对象ID
	* @return err 异常(源文件不存在,新路径已存在)
	 */
	LinkFile(path string, fileKey string) (objectKey string, err error)
}

上传接口

func NewBaiduOss

func NewBaiduOss(clientId string, clientSecret string, region string, bucket string, endpoint string) IUpLoad

type Pair

type Pair struct {
	Key   string
	Value interface{}
}

func (Pair) String

func (p Pair) String() string

Jump to

Keyboard shortcuts

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