mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
friend
This commit is contained in:
parent
47637175d7
commit
2966afca6b
@ -32,7 +32,7 @@ func (f *FriendRequestGorm) Delete(ctx context.Context, fromUserID, toUserID str
|
||||
|
||||
// 更新零值
|
||||
func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error) {
|
||||
return utils.Wrap(f.db(ctx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id ", formUserID, toUserID).Updates(args).Error, "")
|
||||
return utils.Wrap(f.db(ctx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id =?", formUserID, toUserID).Updates(args).Error, "")
|
||||
}
|
||||
|
||||
// 更新多条记录 (非零值)
|
||||
|
@ -2,12 +2,13 @@ package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type MetaDB struct {
|
||||
DB *gorm.DB
|
||||
table interface{}
|
||||
table any
|
||||
}
|
||||
|
||||
func NewMetaDB(db *gorm.DB, table any) *MetaDB {
|
||||
@ -20,7 +21,3 @@ func NewMetaDB(db *gorm.DB, table any) *MetaDB {
|
||||
func (g *MetaDB) db(ctx context.Context) *gorm.DB {
|
||||
return g.DB.WithContext(ctx).Model(g.table)
|
||||
}
|
||||
|
||||
func (g *MetaDB) page(pageNumber, showNumber int32) *gorm.DB {
|
||||
return g.DB.Limit(int(showNumber)).Offset(int(pageNumber*showNumber-1))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user