store

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint string
	Key      string
	Secret   string
	Bucket   string
	LocalDir string
	DB       *gorm.DB
}

type PutChunk

type PutChunk interface {
	// UploadedChunkIndex 已经上传的切片下标
	UploadedChunkIndex() []int
	// ChunkCount 查询切片数量
	ChunkCount() int
	// UploadID 获取上传id
	UploadID() string
	// AppendBytes 添加字节
	AppendBytes(in []byte, index int) error
	// Append 添加io
	Append(r io.Reader, index int) error
	// Abort 取消上传
	Abort() error
	// Complete 完成合并
	Complete() error
}

type Store

type Store interface {
	// PutBytes 上传文件
	PutBytes(key string, in []byte) error
	// Put 上传文件
	Put(key string, r io.Reader) error
	// PutFromLocal 从本地上传文件
	PutFromLocal(key string, localPath string) error
	// Get 查询文件
	Get(key string) (io.ReadCloser, error)
	// Delete 删除文件
	Delete(key string) error
	// Size 获取文件大小
	Size(key string) (int64, error)
	// Exists 判断文件大小
	Exists(key string) (bool, error)
	// NewPutChunk 创建上传切片对象
	NewPutChunk(key string) (PutChunk, error)
	// NewPutChunkByUploadID 通过upload_id创建切片对象
	NewPutChunkByUploadID(key string, id string) (PutChunk, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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