chore: move some types to model
This commit is contained in:
27
internal/model/ifile.go
Normal file
27
internal/model/ifile.go
Normal file
@ -0,0 +1,27 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
type FileInfo interface {
|
||||
GetSize() uint64
|
||||
GetName() string
|
||||
ModTime() time.Time
|
||||
IsDir() bool
|
||||
}
|
||||
|
||||
type FileStreamer interface {
|
||||
io.ReadCloser
|
||||
FileInfo
|
||||
GetMimetype() string
|
||||
}
|
||||
|
||||
type URL interface {
|
||||
URL() string
|
||||
}
|
||||
|
||||
type Thumbnail interface {
|
||||
Thumbnail() string
|
||||
}
|
21
internal/model/link.go
Normal file
21
internal/model/link.go
Normal file
@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LinkArgs struct {
|
||||
IP string
|
||||
Header http.Header
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
URL string
|
||||
Header http.Header // needed header
|
||||
Data io.ReadCloser // return file reader directly
|
||||
Status int // status maybe 200 or 206, etc
|
||||
FilePath *string // local file, return the filepath
|
||||
Expiration *time.Duration // url expiration time
|
||||
}
|
15
internal/model/stream.go
Normal file
15
internal/model/stream.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type FileStream struct {
|
||||
FileInfo
|
||||
io.ReadCloser
|
||||
Mimetype string
|
||||
}
|
||||
|
||||
func (f FileStream) GetMimetype() string {
|
||||
return f.Mimetype
|
||||
}
|
Reference in New Issue
Block a user