增加数据库数据删除方法
This commit is contained in:
parent
6a3bacc5db
commit
5144c85076
11
base.go
11
base.go
@ -7,6 +7,7 @@ package mysql
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@ -43,6 +44,16 @@ func (b *BaseDao) List(dbInstance *gorm.DB, table string, result interface{}, op
|
||||
return dbInstance.Find(result).Error
|
||||
}
|
||||
|
||||
// Delete 删除数据, 硬删除, 对应 delete语句
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:46 2023/2/9
|
||||
func (b *BaseDao) Delete(dbInstance *gorm.DB, table string, dataModel interface{}, optionFuncList ...SetOption) (int64, error) {
|
||||
dbInstance = b.setTxCondition(dbInstance, table, optionFuncList...)
|
||||
return dbInstance.Delete(dataModel).RowsAffected, dbInstance.Delete(dataModel).Error
|
||||
}
|
||||
|
||||
// Detail 查询详情
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
Loading…
Reference in New Issue
Block a user