4 Commits

3 changed files with 64 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
module drogobox.com/drogobox-server
go 1.26.3
+38
View File
@@ -0,0 +1,38 @@
package storage
import (
"io"
"os"
)
type LocalStorage struct {
BaseDir string
}
func (s *LocalStorage) UploadFile(dirPath string, filename string, data io.Reader) error {
//
}
func (s *LocalStorage) ListFiles(dirPath string) ([]FileNode, error) {
//
}
func (s *LocalStorage) ReadFile(filePath string) (*os.File, error) {
//
}
func (s *LocalStorage) WriteFile(dirPath string, filename string, data io.Reader) (int, error) {
// this is explicitly for writing text files that aren't being uploaded
}
func (s *LocalStorage) DeleteFile(filePath string) error {
//
}
func (s *LocalStorage) DeleteDirectory(dirPath string) error {
//
}
func (s *LocalStorage) DeleteDirectoryRecursive(dirPath string) error {
//
}
+23
View File
@@ -0,0 +1,23 @@
package storage
import (
"io"
"os"
)
type Storage interface {
UploadFile(dirPath string, filename string, data io.Reader) error
ListFiles(dirPath string) ([]FileNode, error)
ReadFile(filePath string) (*os.File, error)
WriteFile(dirPath string, filename string, data io.Reader) (int, error)
DeleteFile(filePath string) error
DeleteDirectory(dirPath string) error
DeleteDirectoryRecursive(dirPath string) error
}
type FileNode struct {
RelativeBasePath string
FileName string
IsDirectory bool
FileSize uint64
}