forked from phc/website
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package database
|
|
|
|
type DBMigrate interface {
|
|
Migrate(migrationDir string) error
|
|
}
|
|
|
|
type DBQueryAppunti interface {
|
|
AllDispenseFile() ([]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
|
|
}
|
|
|
|
// DB main "interface group" for interacting with the database, with this technique we can test each "table" api of the DB in isolation.
|
|
type DB struct {
|
|
DBMigrate
|
|
DBDispense
|
|
DBUploads
|
|
DBFileApprovals
|
|
DBDispensaTags
|
|
DBDownloads
|
|
}
|