Merge remote-tracking branch 'origin/errcode' into errcode

This commit is contained in:
Gordon
2023-01-17 20:18:34 +08:00
5 changed files with 206 additions and 20 deletions
+3 -2
View File
@@ -20,6 +20,7 @@ type GroupModelInterface interface {
//mongo
}
type Group struct {
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
GroupName string `gorm:"column:name;size:255" json:"groupName"`
@@ -68,11 +69,11 @@ func (*Group) UpdateByMap(ctx context.Context, groupID string, args map[string]i
return utils.Wrap(GroupDB.Where("group_id = ?", groupID).Updates(args).Error, "")
}
func (*Group) Update(ctx context.Context, groups []*Group) (err error) {
func (g *Group) Update(ctx context.Context, groups []*Group, tx ...*gorm.DB) (err error) {
defer func() {
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups)
}()
return utils.Wrap(GroupDB.Updates(&groups).Error, "")
return utils.Wrap(getDBConn(g.DB, tx...).Updates(&groups).Error, "")
}
func (*Group) Find(ctx context.Context, groupIDs []string) (groups []*Group, err error) {