refac: decouple persistence and image storage behind driver registries
This commit is contained in:
1 parent
421cfafec3
commit
81e299f09a
46 files changed
+1036
-374
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrBlobNotFound = errors.New("stored image content not found")
|
||||
|
||||
const PublicPathPrefix = "/static/uploadedImages/"
|
||||
|
||||
func PublicPath(storedName string) string {
|
||||
return PublicPathPrefix + storedName
|
||||
}
|
||||
|
||||
type Blob struct {
|
||||
Content io.ReadCloser
|
||||
Size int64
|
||||
ModTime time.Time
|
||||
}
|
||||
|
||||
type Storage interface {
|
||||
Put(contentType string, content io.Reader) (string, error)
|
||||
Open(storedName string) (Blob, error)
|
||||
Delete(storedName string) error
|
||||
}
|
||||
Reference in new issue
Block a user