31 lines
593 B
Go
31 lines
593 B
Go
package storage
|
|
|
|
import (
|
|
"io"
|
|
"time"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
const (
|
|
PREFIX_BENEFICIARIES = "beneficiaries"
|
|
)
|
|
|
|
type FileInfo struct {
|
|
Key string
|
|
FileName string
|
|
LastModified time.Time
|
|
ContentType string
|
|
Metadata map[string]string
|
|
}
|
|
|
|
type FileStorage interface {
|
|
Put(reader io.Reader, prefix string, filename string, size int64, metadata map[string]string) error
|
|
List(prefix string) []FileInfo
|
|
Get(prefix string, file string) (io.Reader, *FileInfo, error)
|
|
}
|
|
|
|
func NewFileStorage(cfg *viper.Viper) (FileStorage, error) {
|
|
return NewMinioStorageHandler(cfg)
|
|
}
|