Library/models/books_delete.go
konrad 64dd0ce2d0
Some checks failed
the build failed
Fixed lint
2017-11-08 10:55:17 +01:00

17 lines
296 B
Go

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
}