Library/models/authors_delete.go

16 lines
270 B
Go
Raw Normal View History

package models
2017-11-07 15:35:10 +00:00
func DeleteAuthorByID(id int64) error {
// Delete the author
_, err := x.Id(id).Delete(&Author{})
if err != nil {
return err
}
// Delete all book relations associated with that author
2017-11-07 15:35:10 +00:00
_, err = x.Delete(&AuthorBook{AuthorID: id})
return err
2017-11-07 15:35:10 +00:00
}