diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go index d998f3afb..658a0c5ed 100644 --- a/pkg/common/db/relation/friend_request_model.go +++ b/pkg/common/db/relation/friend_request_model.go @@ -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, "") } // 更新多条记录 (非零值) diff --git a/pkg/common/db/relation/meta_db.go b/pkg/common/db/relation/meta_db.go index f50b94253..2c937f0cb 100644 --- a/pkg/common/db/relation/meta_db.go +++ b/pkg/common/db/relation/meta_db.go @@ -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)) -}