getting to upload
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
package storageRepo
|
||||
|
||||
import (
|
||||
"mime/multipart"
|
||||
"os"
|
||||
|
||||
"git.ma-al.com/goc_daniel/b2b/app/model"
|
||||
)
|
||||
|
||||
type UIStorageRepo interface {
|
||||
EntryInfo(absPath string) (os.FileInfo, error)
|
||||
ListContent(absPath string) (*[]model.EntryInList, error)
|
||||
OpenFile(absPath string) (*os.File, error)
|
||||
CreateFolder(absPath string, name string) error
|
||||
EntryInfo(abs_path string) (os.FileInfo, error)
|
||||
ListContent(abs_path string) (*[]model.EntryInList, error)
|
||||
OpenFile(abs_path string) (*os.File, error)
|
||||
UploadFile(abs_path string, f *multipart.FileHeader) error
|
||||
CreateFolder(abs_path string) error
|
||||
DeleteFile(abs_path string) error
|
||||
DeleteFolder(abs_path string) error
|
||||
}
|
||||
|
||||
type StorageRepo struct{}
|
||||
@@ -19,12 +23,12 @@ func New() UIStorageRepo {
|
||||
return &StorageRepo{}
|
||||
}
|
||||
|
||||
func (r *StorageRepo) EntryInfo(absPath string) (os.FileInfo, error) {
|
||||
return os.Stat(absPath)
|
||||
func (r *StorageRepo) EntryInfo(abs_path string) (os.FileInfo, error) {
|
||||
return os.Stat(abs_path)
|
||||
}
|
||||
|
||||
func (r *StorageRepo) ListContent(absPath string) (*[]model.EntryInList, error) {
|
||||
entries, err := os.ReadDir(absPath)
|
||||
func (r *StorageRepo) ListContent(abs_path string) (*[]model.EntryInList, error) {
|
||||
entries, err := os.ReadDir(abs_path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -42,10 +46,22 @@ func (r *StorageRepo) ListContent(absPath string) (*[]model.EntryInList, error)
|
||||
return &entries_in_list, nil
|
||||
}
|
||||
|
||||
func (r *StorageRepo) OpenFile(absPath string) (*os.File, error) {
|
||||
return os.Open(absPath)
|
||||
func (r *StorageRepo) OpenFile(abs_path string) (*os.File, error) {
|
||||
return os.Open(abs_path)
|
||||
}
|
||||
|
||||
func (r *StorageRepo) CreateFolder(absPath string, name string) error {
|
||||
os.(absPath)
|
||||
func (r *StorageRepo) UploadFile(abs_path string, f *multipart.FileHeader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *StorageRepo) CreateFolder(abs_path string) error {
|
||||
return os.Mkdir(abs_path, 0755)
|
||||
}
|
||||
|
||||
func (r *StorageRepo) DeleteFile(abs_path string) error {
|
||||
return os.Remove(abs_path)
|
||||
}
|
||||
|
||||
func (r *StorageRepo) DeleteFolder(abs_path string) error {
|
||||
return os.RemoveAll(abs_path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user