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

17 lines
318 B
Go

package models
// DeleteAuthorByID deletes an author by its ID
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
_, err = x.Delete(&AuthorBook{AuthorID: id})
return err
}