2019-10-15 12:21:32 +00:00
|
|
|
package media
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2022-10-02 17:34:51 +00:00
|
|
|
"github.com/knadh/listmonk/models"
|
2019-10-15 12:21:32 +00:00
|
|
|
"gopkg.in/volatiletech/null.v6"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Media represents an uploaded object.
|
|
|
|
type Media struct {
|
2023-05-18 11:25:59 +00:00
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
UUID string `db:"uuid" json:"uuid"`
|
|
|
|
Filename string `db:"filename" json:"filename"`
|
|
|
|
ContentType string `db:"content_type" json:"content_type"`
|
|
|
|
Thumb string `db:"thumb" json:"-"`
|
|
|
|
CreatedAt null.Time `db:"created_at" json:"created_at"`
|
|
|
|
ThumbURL null.String `json:"thumb_url"`
|
|
|
|
Provider string `json:"provider"`
|
|
|
|
Meta models.JSON `db:"meta" json:"meta"`
|
|
|
|
URL string `json:"url"`
|
2023-05-21 09:49:12 +00:00
|
|
|
|
|
|
|
Total int `db:"total" json:"-"`
|
2019-10-15 12:21:32 +00:00
|
|
|
}
|
|
|
|
|
2020-07-05 12:05:05 +00:00
|
|
|
// Store represents functions to store and retrieve media (files).
|
2019-10-15 12:21:32 +00:00
|
|
|
type Store interface {
|
|
|
|
Put(string, string, io.ReadSeeker) (string, error)
|
|
|
|
Delete(string) error
|
2023-05-08 14:58:25 +00:00
|
|
|
GetURL(string) string
|
|
|
|
GetBlob(string) ([]byte, error)
|
2019-10-15 12:21:32 +00:00
|
|
|
}
|