storage

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IStorage

type IStorage interface {
	Path() string
	Exist(id string) bool
	Load(id string, fn func(io.Reader) error) error
	Save(id, format string, fn func(io.Writer) error) error
	LoadBytes(id string) ([]byte, error)
	SaveBytes(id, format string, data []byte) error
	Delete(id string) error
	Sub(path string, clean bool) IStorage
}
var (
	Storage IStorage
)

func InitStorage

func InitStorage(config *viper.Viper) (storage IStorage)

type LocalStorage

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

func (*LocalStorage) Delete

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

func (*LocalStorage) Exist

func (s *LocalStorage) Exist(id string) bool

func (*LocalStorage) Load

func (s *LocalStorage) Load(id string, fn func(io.Reader) error) (err error)

func (*LocalStorage) LoadBytes

func (s *LocalStorage) LoadBytes(id string) ([]byte, error)

func (*LocalStorage) Path

func (s *LocalStorage) Path() string

func (*LocalStorage) Save

func (s *LocalStorage) Save(id, format string, fn func(io.Writer) error) error

func (*LocalStorage) SaveBytes

func (s *LocalStorage) SaveBytes(id, format string, data []byte) error

func (*LocalStorage) Sub

func (s *LocalStorage) Sub(path string, clean bool) IStorage

type S3Storage

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

S3Storage is a storage implementation using Amazon S3

func (*S3Storage) Clean

func (s *S3Storage) Clean() error

func (*S3Storage) Delete

func (s *S3Storage) Delete(id string) error

func (*S3Storage) Exist

func (s *S3Storage) Exist(id string) bool

func (*S3Storage) Load

func (s *S3Storage) Load(id string, fn func(io.Reader) error) (err error)

func (*S3Storage) LoadBytes

func (s *S3Storage) LoadBytes(id string) ([]byte, error)

func (*S3Storage) Path

func (s *S3Storage) Path() string

func (*S3Storage) Save

func (s *S3Storage) Save(id, format string, fn func(io.Writer) error) error

func (*S3Storage) SaveBytes

func (s *S3Storage) SaveBytes(id, format string, data []byte) error

func (*S3Storage) Sub

func (s *S3Storage) Sub(path string, clean bool) IStorage

Jump to

Keyboard shortcuts

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