refactor: change driver interface

This commit is contained in:
Noah Hsu
2022-06-15 20:31:23 +08:00
parent d9eb188b7a
commit 09ef7c7106
12 changed files with 181 additions and 136 deletions

View File

@ -3,6 +3,7 @@ package model
import "time"
type File struct {
ID string
Name string
Size uint64
Modified time.Time
@ -25,7 +26,6 @@ func (f File) IsDir() bool {
return f.IsFolder
}
type FileWithId struct {
Id string
File
func (f File) GetID() string {
return f.ID
}

View File

@ -5,16 +5,17 @@ import (
"time"
)
type FileInfo interface {
type Object interface {
GetSize() uint64
GetName() string
ModTime() time.Time
IsDir() bool
GetID() string
}
type FileStreamer interface {
io.ReadCloser
FileInfo
Object
GetMimetype() string
}

View File

@ -5,7 +5,7 @@ import (
)
type FileStream struct {
FileInfo
Object
io.ReadCloser
Mimetype string
}