15 lines
252 B
Go
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
|
||
|
}
|