Library/models/books_delete.go

15 lines
252 B
Go
Raw Normal View History

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
}