mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 19:16:35 +08:00
style: add format and lint (#773)
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
@@ -18,13 +18,15 @@ import (
|
||||
"context"
|
||||
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/protocol/user"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/tx"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
)
|
||||
|
||||
type UserDatabase interface {
|
||||
@@ -162,17 +164,17 @@ func (u *userDatabase) IsExist(ctx context.Context, userIDs []string) (exist boo
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetAllUserID Get all user IDs
|
||||
// GetAllUserID Get all user IDs.
|
||||
func (u *userDatabase) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error) {
|
||||
return u.userDB.GetAllUserID(ctx, pageNumber, showNumber)
|
||||
}
|
||||
|
||||
// CountTotal Get the total number of users
|
||||
// CountTotal Get the total number of users.
|
||||
func (u *userDatabase) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) {
|
||||
return u.userDB.CountTotal(ctx, before)
|
||||
}
|
||||
|
||||
// CountRangeEverydayTotal Get the user increment in the range
|
||||
// CountRangeEverydayTotal Get the user increment in the range.
|
||||
func (u *userDatabase) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {
|
||||
return u.userDB.CountRangeEverydayTotal(ctx, start, end)
|
||||
}
|
||||
@@ -198,7 +200,7 @@ func (u *userDatabase) GetAllSubscribeList(ctx context.Context, userID string) (
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// GetSubscribedList Get all subscribed lists
|
||||
// GetSubscribedList Get all subscribed lists.
|
||||
func (u *userDatabase) GetSubscribedList(ctx context.Context, userID string) ([]string, error) {
|
||||
list, err := u.mongoDB.GetSubscribedList(ctx, userID)
|
||||
if err != nil {
|
||||
@@ -207,13 +209,13 @@ func (u *userDatabase) GetSubscribedList(ctx context.Context, userID string) ([]
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// GetUserStatus get user status
|
||||
// GetUserStatus get user status.
|
||||
func (u *userDatabase) GetUserStatus(ctx context.Context, userIDs []string) ([]*user.OnlineStatus, error) {
|
||||
onlineStatusList, err := u.cache.GetUserStatus(ctx, userIDs)
|
||||
return onlineStatusList, err
|
||||
}
|
||||
|
||||
// SetUserStatus Set the user status and save it in redis
|
||||
// SetUserStatus Set the user status and save it in redis.
|
||||
func (u *userDatabase) SetUserStatus(ctx context.Context, list []*user.OnlineStatus) error {
|
||||
return u.cache.SetUserStatus(ctx, list)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user