storage

package
v0.0.0-...-780aa95 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBytes

func DecodeBytes(data []byte) (string, error)

func DecodeString

func DecodeString(data string) ([]byte, error)

func IsPreview

func IsPreview(file model.File) bool

func StringSize

func StringSize(size int64) string

Types

type AWSStorage

type AWSStorage struct {
	BucketName string
	PathPrefix string
	Config     config.Config
	S3Client   *s3.Client
}

func NewAWS

func NewAWS(pathPrefix string, conf config.Config) *AWSStorage

func (*AWSStorage) Delete

func (s *AWSStorage) Delete(path string) error

func (*AWSStorage) Get

func (s *AWSStorage) Get(path string, passphrase *string) ([]byte, error)

func (*AWSStorage) GetString

func (s *AWSStorage) GetString(path string, passphrase *string) (string, error)

func (*AWSStorage) Path

func (s *AWSStorage) Path(path string) string

func (*AWSStorage) Upload

func (s *AWSStorage) Upload(path string, data []byte) (string, error)

type LocalStorage

type LocalStorage struct {
	BaseDir    string
	PathPrefix string
	MkdirPerm  os.FileMode
	WritePerm  os.FileMode
	ExpireTime time.Duration
	Config     config.Config
}

func NewLocal

func NewLocal(baseDir string, pathPrefix string, conf config.Config) *LocalStorage

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(path string) error

func (*LocalStorage) Get

func (s *LocalStorage) Get(path string, passphrase *string) ([]byte, error)

func (*LocalStorage) GetString

func (s *LocalStorage) GetString(path string, passphrase *string) (string, error)

func (*LocalStorage) Path

func (s *LocalStorage) Path(path string) string

func (*LocalStorage) Upload

func (s *LocalStorage) Upload(path string, data []byte) (string, error)

type Storage

type Storage interface {
	Path(path string) string
	Get(path string, passphrase *string) ([]byte, error)
	GetString(path string, passphrase *string) (string, error)
	Upload(path string, data []byte) (string, error)
	Delete(path string) error
}

func New

func New(c *config.Config) Storage

Jump to

Keyboard shortcuts

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