parcoursmob/utils/storage/files.go

31 lines
593 B
Go
Raw Normal View History

2022-10-31 23:40:20 +00:00
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)
}