Library/models/book_delete.go
konrad 57b6997267 implemented method to delete a book
Signed-off-by: kolaente <konrad@kola-entertainments.de>
2017-10-10 22:47:54 +02:00

15 lines
252 B
Go

package models
func DeleteBookByID(id int64) error {
// Delete the book
_, err := x.Id(id).Delete(&Book{})
if err != nil {
return err
}
// Delete all authors associated with that book
_, err = x.Delete(&AuthorBook{BookID:id})
return err
}