filestores

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 12 Imported by: 4

README

Filestores

I was getting tired creating implementations to save files in local or cloud. By now local and aws is supported.

How to use

Just select one of the available two options:

  • Local
  • AWS

Fullfil constructor requirements and start using.

Reminders

This just cover the basic need to save files...by now.

Documentation

Index

Constants

View Source
const Version = "0.4.1"

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsBucket

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

func NewAwsBucket

func NewAwsBucket(bucket string, config aws.Config) *AwsBucket

func (*AwsBucket) Delete

func (c *AwsBucket) Delete(objectPath string) error

func (*AwsBucket) Get added in v0.4.0

func (c *AwsBucket) Get(objectPath string) (ObjectInfo, error)

func (*AwsBucket) Save

func (c *AwsBucket) Save(input Storable) (string, error)

type FileStore

type FileStore interface {
	Save(input Storable) (string, error)
	Delete(filepath string) error
	Get(filepath string) (ObjectInfo, error)
}

type FileSystem

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

func NewFileSystem

func NewFileSystem(systemPath string) *FileSystem

func (*FileSystem) Delete

func (c *FileSystem) Delete(filepath string) error

func (*FileSystem) Get added in v0.4.0

func (c *FileSystem) Get(objectPath string) (ObjectInfo, error)

func (*FileSystem) Save

func (c *FileSystem) Save(input Storable) (string, error)

type ObjectInfo added in v0.4.0

type ObjectInfo struct {
	Ext, ContentType string
	Reader           io.Reader
	Size             int64
}

func FileHeaderToStoreInfo added in v0.3.0

func FileHeaderToStoreInfo(file *multipart.FileHeader) (ObjectInfo, error)

func FileToStoreInfo added in v0.3.0

func FileToStoreInfo(file *os.File) (ObjectInfo, error)

type Storable

type Storable interface {
	Filename() string
	GetStoreInfo() ObjectInfo
}

Jump to

Keyboard shortcuts

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