数据库支持更新一条数据

This commit is contained in:
2024-01-13 17:08:47 +08:00
parent a76c0a7f8b
commit 1a63a89faf
4 changed files with 49 additions and 13 deletions

10
base.go
View File

@ -48,6 +48,16 @@ func (b *BaseDao) Update(dbInstance *gorm.DB, updateData interface{}, optionFunc
return r.RowsAffected, r.Error
}
// UpdateOne 更新一条数据
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:05 2024/1/13
func (b *BaseDao) UpdateOne(dbInstance *gorm.DB, updateData interface{}, optionFuncList ...SetOption) (int64, error) {
optionFuncList = append(optionFuncList, WithLimit(1, 0))
return b.Update(dbInstance, updateData, optionFuncList...)
}
// List 查询数据列表
//
// Author : go_developer@163.com<白茶清欢>