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.
website/database/database.go

48 lines
1.1 KiB
Go

package database
// Tools
type DBMigrate interface {
Migrate(migrationDir string) error
}
type DBDispense interface {
CreateDispensa(template Dispensa) (string, error)
GetDispensa(id string) (Dispensa, error)
AllDispense() ([]Dispensa, error)
UpdateDispensa(d Dispensa) error
DeleteDispensa(id string) error
}
type DBUploads interface {
CreateUpload(template Upload) (string, error)
GetUpload(id string) (Upload, error)
}
type DBFileApprovals interface {
CreateFileApproval(template FileApproval) (string, error)
GetFileApproval(id string) (FileApproval, error)
AllFileApprovals() ([]FileApproval, error)
UpdateFileApproval(d FileApproval) error
DeleteFileApproval(id string) error
}
type DBDownloads interface {
CreateDownload(template Download) (string, error)
}
type DBTags interface {
SetTags(dispensaId string, tags []string) error
GetTags(dispensaId string) ([]string, 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
DBDownloads
DBTags
}