mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-02 16:15:59 +08:00
fix: fix all lint warning in pkg (#1263)
* fix:fix lint errors in internal * fix:fix lint error in interal/tools * fix: fix lint errros in pkg/statics * fix: fix lint erros in pkg/authverify,pkg/rpcclien * fix: fix lint erros in pkg/common/cmd * fix: fix lint erros in pkg/common/config,convert * fix: fix lint erros in pkg/common/db/cache * fix: fix lint errors in pkg/common/db/controller * fix:fix lint errors in pkg/common/db/relation and pkg/common/db/localcache * fix: fix rest lint errors in pkg/common/db * fix: fix rest lint errors in pkg * fix:set back go.work to use go 1.19
This commit is contained in:
@@ -53,6 +53,7 @@ func (u *UserGorm) Update(ctx context.Context, user *relation.UserModel) (err er
|
||||
// 获取指定用户信息 不存在,也不返回错误.
|
||||
func (u *UserGorm) Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) {
|
||||
err = utils.Wrap(u.db(ctx).Where("user_id in (?)", userIDs).Find(&users).Error, "")
|
||||
|
||||
return users, err
|
||||
}
|
||||
|
||||
@@ -60,6 +61,7 @@ func (u *UserGorm) Find(ctx context.Context, userIDs []string) (users []*relatio
|
||||
func (u *UserGorm) Take(ctx context.Context, userID string) (user *relation.UserModel, err error) {
|
||||
user = &relation.UserModel{}
|
||||
err = utils.Wrap(u.db(ctx).Where("user_id = ?", userID).Take(&user).Error, "")
|
||||
|
||||
return user, err
|
||||
}
|
||||
|
||||
@@ -81,6 +83,7 @@ func (u *UserGorm) Page(
|
||||
Error,
|
||||
"",
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -88,13 +91,14 @@ func (u *UserGorm) Page(
|
||||
func (u *UserGorm) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error) {
|
||||
if pageNumber == 0 || showNumber == 0 {
|
||||
return userIDs, errs.Wrap(u.db(ctx).Pluck("user_id", &userIDs).Error)
|
||||
} else {
|
||||
return userIDs, errs.Wrap(u.db(ctx).Limit(int(showNumber)).Offset(int((pageNumber-1)*showNumber)).Pluck("user_id", &userIDs).Error)
|
||||
}
|
||||
|
||||
return userIDs, errs.Wrap(u.db(ctx).Limit(int(showNumber)).Offset(int((pageNumber-1)*showNumber)).Pluck("user_id", &userIDs).Error)
|
||||
}
|
||||
|
||||
func (u *UserGorm) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error) {
|
||||
err = u.db(ctx).Model(&relation.UserModel{}).Where("user_id = ?", userID).Pluck("global_recv_msg_opt", &opt).Error
|
||||
|
||||
return opt, err
|
||||
}
|
||||
|
||||
@@ -106,6 +110,7 @@ func (u *UserGorm) CountTotal(ctx context.Context, before *time.Time) (count int
|
||||
if err := db.Count(&count).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
@@ -132,5 +137,6 @@ func (u *UserGorm) CountRangeEverydayTotal(
|
||||
for _, r := range res {
|
||||
v[r.Date.Format("2006-01-02")] = r.Count
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user