storage

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitAll

func InitAll(ctx context.Context) error

func Register

func Register(storageType shared.StorageType, f Factory)

func Storages

func Storages() map[shared.StorageType]Storage

Types

type Factory

type Factory func() Storage

type Storage

type Storage interface {
	Init(ctx context.Context) error
	// from: 本地文件路径, to: 存储路径 (如 "2023/01/01/xxxx.jpg")
	//
	// 存储实现可能会对传入的存储路径进行其他处理 (如添加前缀), 因此返回的 StorageDetail 中的 Path 可能与传入的 storagePath 不同.
	Save(ctx context.Context, file io.Reader, to string) (*shared.StorageDetail, error)
	GetFile(ctx context.Context, info shared.StorageDetail) (io.ReadCloser, error)
	Delete(ctx context.Context, info shared.StorageDetail) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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