storage

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Storages = make(map[types.StorageType]Storage)

Functions

func Delete

func Delete(ctx context.Context, info *types.StorageDetail) error

func DeleteAll

func DeleteAll(ctx context.Context, info *types.StorageInfo) error

func GetFile

func GetFile(ctx context.Context, detail *types.StorageDetail) ([]byte, error)

func GetFileStream added in v0.60.0

func GetFileStream(ctx context.Context, detail *types.StorageDetail) (io.ReadCloser, error)

func InitStorage

func InitStorage()

func Save

func Save(ctx context.Context, filePath string, storagePath string, storageType types.StorageType) (*types.StorageDetail, error)

func SaveAll

func SaveAll(ctx context.Context, artwork *types.Artwork, picture *types.Picture) (*types.StorageInfo, error)

将图片保存为所有尺寸

Types

type Storage

type Storage interface {
	Init()
	// filePath 本地文件路径, storagePath 存储路径.
	//
	// 存储实现可能会对传入的存储路径进行其他处理 (如添加前缀), 因此返回的 StorageDetail 中的 Path 可能与传入的 storagePath 不同.
	Save(ctx context.Context, filePath, storagePath string) (*types.StorageDetail, error)
	GetFile(ctx context.Context, info *types.StorageDetail) ([]byte, error)
	GetFileStream(ctx context.Context, info *types.StorageDetail) (io.ReadCloser, error)
	Delete(ctx context.Context, info *types.StorageDetail) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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