28 lines
494 B
Go
28 lines
494 B
Go
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
|
|
}
|