lot of new functionalities
This commit is contained in:
36
core/utils/storage/files.go
Executable file
36
core/utils/storage/files.go
Executable file
@@ -0,0 +1,36 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const (
|
||||
PREFIX_BENEFICIARIES = "beneficiaries"
|
||||
PREFIX_SOLIDARITY_TRANSPORT_DRIVERS = "solidarity_transport/drivers"
|
||||
PREFIX_ORGANIZED_CARPOOL_DRIVERS = "organized_carpool/drivers"
|
||||
PREFIX_BOOKINGS = "fleets_bookings"
|
||||
PREFIX_AGENDA = "event_files"
|
||||
)
|
||||
|
||||
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
|
||||
Delete(prefix string, file string) error
|
||||
}
|
||||
|
||||
func NewFileStorage(cfg *viper.Viper) (FileStorage, error) {
|
||||
return NewMinioStorageHandler(cfg)
|
||||
}
|
||||
Reference in New Issue
Block a user