package models // DeleteBookByID deletes a book by its ID 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 }