增加数据库异常是否为数据不存在
This commit is contained in:
9
base.go
9
base.go
@ -70,6 +70,15 @@ func (b *BaseDao) Detail(dbInstance *gorm.DB, result interface{}, optionFuncList
|
||||
return dbInstance.Table(b.TableName).First(result).Error
|
||||
}
|
||||
|
||||
// IsNotFound 增加结果是否为数据不存在的判断
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:57 2023/2/23
|
||||
func (b *BaseDao) IsNotFound(err error) bool {
|
||||
return err == gorm.ErrRecordNotFound
|
||||
}
|
||||
|
||||
// Count 查询数量
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
Reference in New Issue
Block a user