test-errcode
withchao 2 years ago
parent 891e631b91
commit 601fac7a04

@ -29,7 +29,7 @@ type Group struct {
func NewGroupDB(db *gorm.DB) *Group {
var group Group
group.DB = db.Model(&Group{})
group.DB = db
return &group
}
@ -45,7 +45,7 @@ func (g *Group) Delete(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (
defer func() {
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs)
}()
return utils.Wrap(getDBConn(g.DB, tx...).Where("group_id in (?)", groupIDs).Delete(&Group{}).Error, "")
return utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Delete(&Group{}).Error, "")
}
func (g *Group) UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) {

@ -87,7 +87,7 @@ func (w Writer) Printf(format string, args ...interface{}) {
fmt.Printf(format, args...)
}
func getDBConn(db *gorm.DB, tx ...*gorm.DB) *gorm.DB {
func getDBConn(db *gorm.DB, tx []*gorm.DB) *gorm.DB {
if len(tx) > 0 {
return tx[0]
}

Loading…
Cancel
Save