Library/models/authors_delete.go
kolaente 500007bdae Added method to add and delete an author
Signed-off-by: kolaente <konrad@kola-entertainments.de>
2017-10-11 17:20:56 +02:00

15 lines
269 B
Go

package models
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
}