parcoursmob/utils/storage/files.go

33 lines
672 B
Go
Executable File

package storage
import (
"io"
"time"
"github.com/spf13/viper"
)
const (
PREFIX_BENEFICIARIES = "beneficiaries"
PREFIX_BOOKINGS = "fleets_bookings"
)
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)
Copy(src string, dest string) error
}
func NewFileStorage(cfg *viper.Viper) (FileStorage, error) {
return NewMinioStorageHandler(cfg)
}