28 lines
861 B
Go
28 lines
861 B
Go
package domain
|
|
|
|
import (
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
type File struct {
|
|
ID string `db:"id" json:"id"`
|
|
Name string `db:"name" json:"name"`
|
|
ContentType string `db:"content_type" json:"contentType"`
|
|
StoragePath string `db:"storage_path" json:"-"`
|
|
StorageFilename string `db:"storage_filename" json:"-"`
|
|
Content []byte `db:"content" json:"-"`
|
|
DateCreated time.Time `db:"date_created" json:"-"`
|
|
DateUpdated time.Time `db:"date_updated" json:"-"`
|
|
VersionId string `db:"_version" json:"-"`
|
|
}
|
|
|
|
type FileRepository interface {
|
|
FindByID(id string) (*File, error)
|
|
Create(file *File) (*File, error)
|
|
Update(file *File) (*File, error)
|
|
Delete(id string) error
|
|
Upload(reader io.Reader, path string, name string, contentType string, replace bool) (*File, error)
|
|
Download(id string) (*File, error)
|
|
}
|