storage

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmpty = errors.New("empty storage")
)

Functions

func Init

func Init(ctx context.Context) (err error)

func MustInit

func MustInit(ctx context.Context)

Types

type Config

type Config struct {
	Type     Type   `json:"type"`
	Endpoint string `json:"endpoint"`
	AccessId string `json:"access_id"`
	Secret   string `json:"secret"`
	SSL      bool   `json:"ssl"`
	Bucket   string `json:"bucket"`
}

type IStorage

type IStorage interface {
	Put(ctx context.Context, name string, r io.Reader) (key string, err error)
	Get(ctx context.Context, name string) (rc io.ReadCloser, err error)
	Delete(ctx context.Context, name string) (err error)
	SignGetUrl(ctx context.Context, name string, expires int64, contentType string, disposition string) (s string, err error)
	SignPutUrl(ctx context.Context, name string, expires int64) (s string, err error)
}

func Default

func Default() IStorage

func New

func New(config Config) (s IStorage, err error)

func Storage

func Storage(name ...string) IStorage

type Type

type Type string
const (
	TypeMinio Type = "minio"
)

Jump to

Keyboard shortcuts

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