Remove RecordNotFound method

This commit is contained in:
Jinzhu
2020-06-07 22:03:45 +08:00
parent 31a0553b82
commit e7b2e92ce3
5 changed files with 8 additions and 10 deletions
+3 -1
View File
@@ -1,8 +1,10 @@
package tests_test
import (
"errors"
"testing"
"gorm.io/gorm"
. "gorm.io/gorm/utils/tests"
)
@@ -22,7 +24,7 @@ func TestSoftDelete(t *testing.T) {
}
DB.Unscoped().Delete(&user)
if !DB.Unscoped().First(&User{}, "name = ?", user.Name).RecordNotFound() {
if err := DB.Unscoped().First(&User{}, "name = ?", user.Name).Error; !errors.Is(err, gorm.ErrRecordNotFound) {
t.Errorf("Can't find permanently deleted record")
}
}