|
|
|
package database
|
|
|
|
|
|
|
|
type DBMigrate interface {
|
|
|
|
Migrate(migrationDir string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBQueryAppunti interface {
|
|
|
|
AllDispensaFile() ([]DispensaFile, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBDispense interface {
|
|
|
|
Create(template Dispensa) (string, error)
|
|
|
|
Get(id string) (Dispensa, error)
|
|
|
|
All() ([]Dispensa, error)
|
|
|
|
Update(d Dispensa) error
|
|
|
|
Delete(id string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBUploads interface {
|
|
|
|
Create(template Upload) (string, error)
|
|
|
|
Get(id string) (Upload, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBFileApprovals interface {
|
|
|
|
Create(template FileApproval) (string, error)
|
|
|
|
Get(id string) (FileApproval, error)
|
|
|
|
All() ([]FileApproval, error)
|
|
|
|
Update(d FileApproval) error
|
|
|
|
Delete(id string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBDispensaTags interface {
|
|
|
|
Set(dispensaId string, tags []string) error
|
|
|
|
Get(dispensaId string) ([]string, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DBDownloads interface {
|
|
|
|
Create(template Download) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type DB struct {
|
|
|
|
DBMigrate
|
|
|
|
DBQueryAppunti
|
|
|
|
|
|
|
|
Dispense DBDispense
|
|
|
|
Uploads DBUploads
|
|
|
|
FileApprovals DBFileApprovals
|
|
|
|
DispensaTags DBDispensaTags
|
|
|
|
Downloads DBDownloads
|
|
|
|
}
|