fix: delete method
This commit is contained in:
@@ -35,9 +35,9 @@ func (service *AuthorService) Update(item Author) (Author, error) {
|
||||
err := dal.Author.Preload(field.Associations).Save(&item)
|
||||
return item, err
|
||||
}
|
||||
func (service *AuthorService) Delete(item Author) (Author, error) {
|
||||
_, err := dal.Author.Unscoped().Preload(field.Associations).Delete(&item)
|
||||
return item, err
|
||||
func (service *AuthorService) Delete(id uint) error {
|
||||
_, err := dal.Author.Unscoped().Where(dal.Author.Id.Eq(id)).Delete()
|
||||
return err
|
||||
}
|
||||
func (service *AuthorService) Count() (int64, error) {
|
||||
amount, err := dal.Author.Count()
|
||||
|
||||
Reference in New Issue
Block a user