storage

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessMode

type AccessMode string

AccessMode 访问模式

const (
	Private         AccessMode = "private"           // 私有读写
	PublicRead      AccessMode = "public-read"       // 公共读
	PublicReadWrite AccessMode = "public-read-write" // 公共读写
)

type CloudStorage

type CloudStorage struct {
	AccessKey            string     `json:"access_key"`
	AccessSecret         string     `json:"access_secret"`
	Bucket               string     `json:"bucket"`
	Endpoint             string     `json:"endpoint"`
	InternalEndpoint     string     `json:"internal_endpoint"`
	WithInternalEndpoint bool       `json:"with_internal_endpoint"`
	Region               string     `json:"region"`
	UseSSL               bool       `json:"use_ssl"`
	AccessMode           AccessMode `json:"access_mode"`
}

type Config

type Config struct {
	Driver    string
	CdnDomain string       `json:"cdn_domain"`
	Local     Local        `json:"local"`
	Minio     CloudStorage `json:"minio"`
	AliOss    CloudStorage `json:"ali_oss"`
	HwObs     CloudStorage `json:"hw_obs"`
	TxCos     CloudStorage `json:"tx_cos"`
	S3        CloudStorage `json:"s3"`
}

type Local

type Local struct {
	RootPath         string                 `json:"root_path"`
	MultipartStorage local.MultipartStorage `json:"multipart_storage"`
}

type RedisMultipartStorage

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

RedisMultipartStorage Redis实现的本地文件分片上传状态存储

func NewRedisMultipartStorage

func NewRedisMultipartStorage(client redis.Cmdable, prefix string) *RedisMultipartStorage

func (*RedisMultipartStorage) Delete

func (s *RedisMultipartStorage) Delete(uploadID string) error

func (*RedisMultipartStorage) Get

func (*RedisMultipartStorage) List

func (*RedisMultipartStorage) Save

type Storage

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

func Init

func Init(c *config.Config) (*Storage, error)

func Instance

func Instance() *Storage

Instance 获取文件存储器实例

func (*Storage) CdnDomain

func (storage *Storage) CdnDomain() string

func (*Storage) FileSystem

func (storage *Storage) FileSystem() fs.FileSystem

func (*Storage) FullUrl

func (storage *Storage) FullUrl(ctx context.Context, path string) string

func (*Storage) RelativePath

func (storage *Storage) RelativePath(ctx context.Context, path string) string

func (*Storage) SignFullUrl

func (storage *Storage) SignFullUrl(ctx context.Context, path string) string

Jump to

Keyboard shortcuts

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