mirror of
https://github.com/knadh/listmonk.git
synced 2025-01-07 23:12:04 +08:00
e5c3196b31
This commit introduces a `blobstore` package and refactors the existing upload mechanism. Upload is now handled by `providers` and the two bundled providers are `S3` and `Filesystem`. `app.Blobstore` initialises the correct provider based on the configuration and handles `Put`, `Delete` and `Get` operations.
26 lines
687 B
Go
26 lines
687 B
Go
package media
|
|
|
|
import (
|
|
"io"
|
|
|
|
"gopkg.in/volatiletech/null.v6"
|
|
)
|
|
|
|
// Media represents an uploaded object.
|
|
type Media struct {
|
|
ID int `db:"id" json:"id"`
|
|
UUID string `db:"uuid" json:"uuid"`
|
|
Filename string `db:"filename" json:"filename"`
|
|
Width int `db:"width" json:"width"`
|
|
Height int `db:"height" json:"height"`
|
|
CreatedAt null.Time `db:"created_at" json:"created_at"`
|
|
ThumbURI string `json:"thumb_uri"`
|
|
URI string `json:"uri"`
|
|
}
|
|
|
|
// Store represents set of methods to perform upload/delete operations.
|
|
type Store interface {
|
|
Put(string, string, io.ReadSeeker) (string, error)
|
|
Delete(string) error
|
|
Get(string) string
|
|
}
|