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 }