mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-03 08:16:55 +08:00
1
This commit is contained in:
parent
891e631b91
commit
601fac7a04
@ -29,7 +29,7 @@ type Group struct {
|
|||||||
|
|
||||||
func NewGroupDB(db *gorm.DB) *Group {
|
func NewGroupDB(db *gorm.DB) *Group {
|
||||||
var group Group
|
var group Group
|
||||||
group.DB = db.Model(&Group{})
|
group.DB = db
|
||||||
return &group
|
return &group
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ func (g *Group) Delete(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (
|
|||||||
defer func() {
|
defer func() {
|
||||||
trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs)
|
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) {
|
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...)
|
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 {
|
if len(tx) > 0 {
|
||||||
return tx[0]
|
return tx[0]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user