oss

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BusinessProductManage = "productManage" //产品管理
	SceneProductImg       = "productImg"    //产品图片
)

产品管理

Variables

This section is empty.

Functions

func CheckWithCopy added in v0.5.1

func CheckWithCopy(ctx context.Context, handle Handle, srcPath string, business, scene string) (string, error)

func GetFilePath added in v0.5.1

func GetFilePath(scene *SceneInfo, rename bool) (string, error)

Types

type AliYunOss added in v0.5.1

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

func (*AliYunOss) CopyFromTempBucket added in v0.5.1

func (a *AliYunOss) CopyFromTempBucket(tempPath, dstPath string) (string, error)

func (*AliYunOss) Delete added in v0.5.1

func (a *AliYunOss) Delete(ctx context.Context, fileDir string, opKv common.OptionKv) error

func (*AliYunOss) GetObjectInfo added in v0.5.1

func (a *AliYunOss) GetObjectInfo(ctx context.Context, fileDir string) (*common.StorageObjectInfo, error)

func (*AliYunOss) GetUrl added in v0.5.1

func (a *AliYunOss) GetUrl(filePath string) (string, error)

func (*AliYunOss) PrivateBucket added in v0.5.1

func (a *AliYunOss) PrivateBucket() Handle

func (*AliYunOss) PublicBucket added in v0.5.1

func (a *AliYunOss) PublicBucket() Handle

func (*AliYunOss) SignedGetUrl added in v0.5.1

func (a *AliYunOss) SignedGetUrl(ctx context.Context, fileDir string, expiredSec int64, opKv common.OptionKv) (string, error)

func (*AliYunOss) SignedPutUrl added in v0.5.1

func (a *AliYunOss) SignedPutUrl(ctx context.Context, fileDir string, expiredSec int64, opKv common.OptionKv) (string, error)

获取put上传url

func (*AliYunOss) TemporaryBucket added in v0.5.1

func (a *AliYunOss) TemporaryBucket() Handle

func (*AliYunOss) Upload added in v0.5.1

func (a *AliYunOss) Upload(ctx context.Context, filePath string, content io.Reader, opKv common.OptionKv) (string, error)

type Client added in v0.5.1

type Client struct {
	Handle
}

func NewOssClient added in v0.5.1

func NewOssClient(c conf.OssConf) *Client

type Handle added in v0.5.1

type Handle interface {
	SignedPutUrl(ctx context.Context, objectName string, expiredSec int64, opKv common.OptionKv) (string, error)
	SignedGetUrl(ctx context.Context, objectName string, expiredSec int64, opKv common.OptionKv) (string, error)
	Delete(ctx context.Context, objectName string, opKv common.OptionKv) error
	Upload(ctx context.Context, objectName string, reader io.Reader, opKv common.OptionKv) (string, error)
	GetObjectInfo(ctx context.Context, objectName string) (*common.StorageObjectInfo, error)
	PrivateBucket() Handle
	PublicBucket() Handle
	TemporaryBucket() Handle
	CopyFromTempBucket(tempPath, dstPath string) (string, error)
	GetUrl(path string) (string, error)
}

type Minio added in v0.5.1

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

func (*Minio) CopyFromTempBucket added in v0.5.1

func (m *Minio) CopyFromTempBucket(tempPath, dstPath string) (string, error)

func (*Minio) Delete added in v0.5.1

func (m *Minio) Delete(ctx context.Context, fileDir string, opKv common.OptionKv) error

删除

func (*Minio) GetObjectInfo added in v0.5.1

func (m *Minio) GetObjectInfo(ctx context.Context, filePath string) (*common.StorageObjectInfo, error)

func (*Minio) GetUrl added in v0.5.1

func (m *Minio) GetUrl(path string) (string, error)

获取完整链接

func (*Minio) IsObjectExist added in v0.5.1

func (m *Minio) IsObjectExist(ctx context.Context, filePath string, opKv common.OptionKv) (bool, error)

func (*Minio) PrivateBucket added in v0.5.1

func (m *Minio) PrivateBucket() Handle

func (*Minio) PublicBucket added in v0.5.1

func (m *Minio) PublicBucket() Handle

func (*Minio) SignedGetUrl added in v0.5.1

func (m *Minio) SignedGetUrl(ctx context.Context, fileDir string, expiredSec int64, opKv common.OptionKv) (string, error)

获取get下载url

func (*Minio) SignedPutUrl added in v0.5.1

func (m *Minio) SignedPutUrl(ctx context.Context, fileDir string, expiredSec int64, opKv common.OptionKv) (string, error)

获取put上传url

func (*Minio) TemporaryBucket added in v0.5.1

func (m *Minio) TemporaryBucket() Handle

func (*Minio) Upload added in v0.5.1

func (m *Minio) Upload(ctx context.Context, filePath string, reader io.Reader, opKv common.OptionKv) (string, error)

type OpOption added in v0.5.1

type OpOption func(*common.OptionKv)

type SceneInfo added in v0.5.1

type SceneInfo struct {
	Business string
	Scene    string
	FilePath string
	FileName string
}

func GetSceneInfo added in v0.5.1

func GetSceneInfo(filePath string) (*SceneInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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