更新方法增加影响行数的返回

This commit is contained in:
白茶清欢 2022-06-28 23:41:50 +08:00
parent a76438e7ce
commit b5574d07ef
1 changed files with 3 additions and 2 deletions

View File

@ -26,9 +26,10 @@ func (b *BaseDao) Create(dbInstance *gorm.DB, table string, data interface{}) er
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 8:12 下午 2021/8/8 // Date : 8:12 下午 2021/8/8
func (b *BaseDao) Update(dbInstance *gorm.DB, table string, updateDate interface{}, optionFuncList ...SetOption) error { func (b *BaseDao) Update(dbInstance *gorm.DB, table string, updateDate interface{}, optionFuncList ...SetOption) (int64, error) {
b.setTxCondition(dbInstance, table, optionFuncList...) b.setTxCondition(dbInstance, table, optionFuncList...)
return dbInstance.Updates(updateDate).Error r := dbInstance.Updates(updateDate)
return r.RowsAffected, r.Error
} }
// List 查询数据列表 // List 查询数据列表