From fe2c504fdcfb1d1973e20469d22ae296a45ec058 Mon Sep 17 00:00:00 2001 From: fenghao Date: Wed, 4 Dec 2024 11:56:29 +0800 Subject: [PATCH] fix: #2888 sort import modules --- cmd/openim-api/main.go | 6 ++-- cmd/openim-cmdutils/main.go | 3 +- cmd/openim-crontask/main.go | 3 +- cmd/openim-msggateway/main.go | 3 +- cmd/openim-msgtransfer/main.go | 3 +- cmd/openim-push/main.go | 3 +- cmd/openim-rpc/openim-rpc-auth/main.go | 3 +- .../openim-rpc-conversation/main.go | 3 +- cmd/openim-rpc/openim-rpc-friend/main.go | 3 +- cmd/openim-rpc/openim-rpc-group/main.go | 3 +- cmd/openim-rpc/openim-rpc-msg/main.go | 3 +- cmd/openim-rpc/openim-rpc-third/main.go | 3 +- cmd/openim-rpc/openim-rpc-user/main.go | 3 +- internal/api/auth.go | 4 ++- internal/api/conversation.go | 4 ++- internal/api/custom_validator.go | 1 + internal/api/friend.go | 3 +- internal/api/group.go | 4 ++- internal/api/init.go | 11 +++--- internal/api/jssdk/jssdk.go | 4 ++- internal/api/jssdk/tools.go | 10 +++--- internal/api/msg.go | 10 +++--- internal/api/router.go | 16 ++++----- internal/api/statistics.go | 4 ++- internal/api/third.go | 6 ++-- internal/api/user.go | 4 ++- internal/msggateway/callback.go | 5 +-- internal/msggateway/client.go | 5 +-- internal/msggateway/compressor_test.go | 3 +- internal/msggateway/context.go | 3 +- internal/msggateway/hub_server.go | 12 ++++--- internal/msggateway/init.go | 9 ++--- internal/msggateway/long_conn.go | 4 +-- internal/msggateway/message_handler.go | 5 +-- internal/msggateway/online.go | 12 ++++--- internal/msggateway/subscription.go | 6 ++-- internal/msggateway/user_map.go | 3 +- internal/msggateway/ws_server.go | 18 +++++----- internal/msgtransfer/init.go | 19 +++++----- .../msgtransfer/online_history_msg_handler.go | 18 +++++----- .../online_msg_to_mongo_handler.go | 10 +++--- internal/push/callback.go | 7 ++-- internal/push/offlinepush/dummy/push.go | 4 ++- internal/push/offlinepush/fcm/push.go | 14 ++++---- internal/push/offlinepush/getui/push.go | 10 +++--- .../push/offlinepush/jpush/body/platform.go | 3 +- internal/push/offlinepush/jpush/push.go | 3 +- internal/push/offlinepush/offlinepusher.go | 3 +- internal/push/offlinepush_handler.go | 10 +++--- internal/push/onlinepusher.go | 8 +++-- internal/push/push.go | 10 +++--- internal/push/push_handler.go | 27 +++++++------- internal/rpc/auth/auth.go | 21 +++++------ internal/rpc/conversation/conversation.go | 25 ++++++------- internal/rpc/conversation/notification.go | 5 +-- internal/rpc/conversation/sync.go | 3 +- internal/rpc/group/cache.go | 3 +- internal/rpc/group/callback.go | 11 +++--- internal/rpc/group/convert.go | 3 +- internal/rpc/group/fill.go | 1 + internal/rpc/group/group.go | 33 ++++++++--------- internal/rpc/group/notification.go | 25 +++++++------ internal/rpc/group/sync.go | 11 +++--- internal/rpc/incrversion/batch_option.go | 6 ++-- internal/rpc/incrversion/option.go | 6 ++-- internal/rpc/msg/as_read.go | 6 ++-- internal/rpc/msg/callback.go | 10 +++--- internal/rpc/msg/clear.go | 8 +++-- internal/rpc/msg/delete.go | 3 +- internal/rpc/msg/filter.go | 8 +++-- internal/rpc/msg/notification.go | 3 +- internal/rpc/msg/revoke.go | 7 ++-- internal/rpc/msg/send.go | 9 ++--- internal/rpc/msg/seq.go | 6 ++-- internal/rpc/msg/server.go | 19 +++++----- internal/rpc/msg/statistics.go | 3 +- internal/rpc/msg/stream_msg.go | 8 +++-- internal/rpc/msg/sync_msg.go | 7 ++-- internal/rpc/msg/utils.go | 5 +-- internal/rpc/msg/verify.go | 9 ++--- internal/rpc/relation/black.go | 8 ++--- internal/rpc/relation/callback.go | 4 +-- internal/rpc/relation/friend.go | 28 +++++++-------- internal/rpc/relation/notification.go | 14 ++++---- internal/rpc/relation/sync.go | 7 ++-- internal/rpc/third/log.go | 8 ++--- internal/rpc/third/s3.go | 9 ++--- internal/rpc/third/third.go | 16 +++++---- internal/rpc/third/tool.go | 3 +- internal/rpc/user/callback.go | 4 +-- internal/rpc/user/notification.go | 9 ++--- internal/rpc/user/online.go | 3 +- internal/rpc/user/user.go | 35 ++++++++++--------- internal/tools/cron_task.go | 16 ++++----- pkg/authverify/token.go | 4 ++- pkg/callbackstruct/common.go | 3 +- pkg/callbackstruct/group.go | 3 +- pkg/common/cmd/api.go | 6 ++-- pkg/common/cmd/auth.go | 6 ++-- pkg/common/cmd/conversation.go | 6 ++-- pkg/common/cmd/cron_task.go | 6 ++-- pkg/common/cmd/friend.go | 6 ++-- pkg/common/cmd/group.go | 6 ++-- pkg/common/cmd/msg.go | 6 ++-- pkg/common/cmd/msg_gateway.go | 7 ++-- pkg/common/cmd/msg_gateway_test.go | 5 +-- pkg/common/cmd/msg_transfer.go | 6 ++-- pkg/common/cmd/push.go | 6 ++-- pkg/common/cmd/root.go | 8 +++-- pkg/common/cmd/third.go | 6 ++-- pkg/common/cmd/user.go | 6 ++-- pkg/common/config/load_config.go | 6 ++-- pkg/common/config/load_config_test.go | 3 +- pkg/common/config/parse.go | 6 ++-- pkg/common/convert/black.go | 3 +- pkg/common/convert/conversation.go | 3 +- pkg/common/convert/friend.go | 5 +-- pkg/common/convert/group.go | 3 +- pkg/common/convert/msg.go | 3 +- pkg/common/convert/user.go | 5 +-- pkg/common/convert/user_test.go | 3 +- .../direct/direct_resolver.go | 3 +- .../discoveryregister/discoveryregister.go | 8 +++-- .../kubernetes/kubernetes.go | 5 +-- pkg/common/prommetrics/api.go | 3 +- pkg/common/prommetrics/prommetrics.go | 3 +- pkg/common/prommetrics/rpc.go | 6 ++-- pkg/common/startrpc/start.go | 20 ++++++----- pkg/common/storage/cache/cachekey/msg.go | 3 +- pkg/common/storage/cache/cachekey/token.go | 3 +- pkg/common/storage/cache/conversation.go | 1 + pkg/common/storage/cache/friend.go | 1 + pkg/common/storage/cache/redis/batch.go | 10 +++--- .../storage/cache/redis/batch_handler.go | 11 +++--- pkg/common/storage/cache/redis/batch_test.go | 8 +++-- pkg/common/storage/cache/redis/black.go | 9 +++-- .../storage/cache/redis/conversation.go | 17 +++++---- pkg/common/storage/cache/redis/friend.go | 8 +++-- pkg/common/storage/cache/redis/group.go | 10 +++--- pkg/common/storage/cache/redis/lua_script.go | 7 ++-- .../storage/cache/redis/lua_script_test.go | 3 +- pkg/common/storage/cache/redis/msg.go | 17 +++++---- pkg/common/storage/cache/redis/msg_test.go | 6 ++-- pkg/common/storage/cache/redis/online.go | 15 ++++---- pkg/common/storage/cache/redis/online_test.go | 6 ++-- .../cache/redis/redis_shard_manager.go | 6 ++-- pkg/common/storage/cache/redis/s3.go | 13 ++++--- .../storage/cache/redis/seq_conversation.go | 13 ++++--- .../cache/redis/seq_conversation_test.go | 10 +++--- pkg/common/storage/cache/redis/seq_user.go | 11 +++--- .../storage/cache/redis/seq_user_test.go | 12 ++++--- pkg/common/storage/cache/redis/third.go | 9 +++-- pkg/common/storage/cache/redis/token.go | 11 +++--- pkg/common/storage/cache/redis/user.go | 9 +++-- pkg/common/storage/cache/s3.go | 4 ++- pkg/common/storage/cache/seq_conversation.go | 1 + pkg/common/storage/cache/user.go | 1 + pkg/common/storage/controller/auth.go | 11 +++--- pkg/common/storage/controller/black.go | 8 +++-- pkg/common/storage/controller/conversation.go | 10 +++--- pkg/common/storage/controller/friend.go | 9 ++--- pkg/common/storage/controller/group.go | 15 ++++---- pkg/common/storage/controller/msg.go | 15 ++++---- pkg/common/storage/controller/msg_transfer.go | 14 ++++---- pkg/common/storage/controller/push.go | 5 +-- pkg/common/storage/controller/s3.go | 11 +++--- pkg/common/storage/controller/stream_msg.go | 3 +- pkg/common/storage/controller/third.go | 6 ++-- pkg/common/storage/controller/user.go | 9 +++-- pkg/common/storage/database/black.go | 4 ++- pkg/common/storage/database/conversation.go | 3 +- pkg/common/storage/database/friend.go | 3 +- pkg/common/storage/database/friend_request.go | 4 ++- pkg/common/storage/database/group.go | 6 ++-- pkg/common/storage/database/group_member.go | 3 +- pkg/common/storage/database/group_request.go | 4 ++- pkg/common/storage/database/log.go | 6 ++-- pkg/common/storage/database/mgo/black.go | 10 +++--- .../storage/database/mgo/conversation.go | 11 +++--- pkg/common/storage/database/mgo/friend.go | 12 ++++--- .../storage/database/mgo/friend_request.go | 10 +++--- pkg/common/storage/database/mgo/group.go | 12 ++++--- .../storage/database/mgo/group_member.go | 13 +++---- .../storage/database/mgo/group_request.go | 12 ++++--- pkg/common/storage/database/mgo/helpers.go | 3 +- pkg/common/storage/database/mgo/log.go | 10 +++--- pkg/common/storage/database/mgo/msg.go | 15 ++++---- pkg/common/storage/database/mgo/msg_test.go | 17 +++++---- pkg/common/storage/database/mgo/object.go | 11 +++--- .../storage/database/mgo/seq_conversation.go | 9 +++-- .../database/mgo/seq_conversation_test.go | 5 +-- pkg/common/storage/database/mgo/seq_user.go | 9 +++-- pkg/common/storage/database/mgo/stream_msg.go | 13 ++++--- pkg/common/storage/database/mgo/user.go | 14 ++++---- .../storage/database/mgo/version_log.go | 14 ++++---- .../storage/database/mgo/version_test.go | 8 +++-- pkg/common/storage/database/msg.go | 6 ++-- pkg/common/storage/database/object.go | 3 +- pkg/common/storage/database/stream_msg.go | 3 +- pkg/common/storage/database/user.go | 6 ++-- pkg/common/storage/model/application.go | 3 +- pkg/common/storage/model/friend.go | 3 +- pkg/common/storage/model/msg.go | 3 +- pkg/common/storage/model/version_log.go | 6 ++-- pkg/common/storage/versionctx/rpc.go | 1 + pkg/common/storage/versionctx/version.go | 3 +- pkg/common/webhook/condition.go | 1 + pkg/common/webhook/http_client.go | 10 +++--- pkg/localcache/init.go | 5 +-- pkg/msgprocessor/conversation.go | 3 +- pkg/rpccache/common.go | 3 +- pkg/rpccache/conversation.go | 15 ++++---- pkg/rpccache/friend.go | 8 +++-- pkg/rpccache/group.go | 12 ++++--- pkg/rpccache/online.go | 14 ++++---- pkg/rpccache/subscriber.go | 5 +-- pkg/rpccache/user.go | 12 ++++--- pkg/rpcclient/auth.go | 3 +- pkg/rpcclient/conversation.go | 3 +- pkg/rpcclient/friend.go | 3 +- pkg/rpcclient/group.go | 3 +- pkg/rpcclient/msg.go | 3 +- pkg/rpcclient/push.go | 3 +- pkg/rpcclient/third.go | 3 +- pkg/rpcclient/user.go | 8 +++-- pkg/tools/batcher/batcher.go | 5 +-- pkg/tools/batcher/batcher_test.go | 3 +- tools/check-component/main.go | 5 +-- tools/seq/internal/main.go | 23 ++++++------ tools/seq/main.go | 3 +- tools/streammsg/main.go | 15 ++++---- tools/url2im/pkg/manage.go | 3 +- tools/versionchecker/main.go | 1 + 233 files changed, 1055 insertions(+), 715 deletions(-) diff --git a/cmd/openim-api/main.go b/cmd/openim-api/main.go index 3690cfc991..04a2b04e9a 100644 --- a/cmd/openim-api/main.go +++ b/cmd/openim-api/main.go @@ -15,9 +15,11 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" - "github.com/openimsdk/tools/system/program" _ "net/http/pprof" + + "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-cmdutils/main.go b/cmd/openim-cmdutils/main.go index 433eefb325..3b497d0290 100644 --- a/cmd/openim-cmdutils/main.go +++ b/cmd/openim-cmdutils/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-crontask/main.go b/cmd/openim-crontask/main.go index 6745065187..b1ed57cd23 100644 --- a/cmd/openim-crontask/main.go +++ b/cmd/openim-crontask/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-msggateway/main.go b/cmd/openim-msggateway/main.go index 6e3eda6bf6..b4444fd7bd 100644 --- a/cmd/openim-msggateway/main.go +++ b/cmd/openim-msggateway/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-msgtransfer/main.go b/cmd/openim-msgtransfer/main.go index 23b629d69a..0ce7205c06 100644 --- a/cmd/openim-msgtransfer/main.go +++ b/cmd/openim-msgtransfer/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-push/main.go b/cmd/openim-push/main.go index cd5106d173..e06fe61186 100644 --- a/cmd/openim-push/main.go +++ b/cmd/openim-push/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-auth/main.go b/cmd/openim-rpc/openim-rpc-auth/main.go index 158b1f4647..853ee27d5b 100644 --- a/cmd/openim-rpc/openim-rpc-auth/main.go +++ b/cmd/openim-rpc/openim-rpc-auth/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-conversation/main.go b/cmd/openim-rpc/openim-rpc-conversation/main.go index 5b2e66c954..63c486498a 100644 --- a/cmd/openim-rpc/openim-rpc-conversation/main.go +++ b/cmd/openim-rpc/openim-rpc-conversation/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-friend/main.go b/cmd/openim-rpc/openim-rpc-friend/main.go index 745c405532..38ec1bc599 100644 --- a/cmd/openim-rpc/openim-rpc-friend/main.go +++ b/cmd/openim-rpc/openim-rpc-friend/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-group/main.go b/cmd/openim-rpc/openim-rpc-group/main.go index 5badf934e9..aa1a576668 100644 --- a/cmd/openim-rpc/openim-rpc-group/main.go +++ b/cmd/openim-rpc/openim-rpc-group/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-msg/main.go b/cmd/openim-rpc/openim-rpc-msg/main.go index 37f6cf237a..3238bad8e9 100644 --- a/cmd/openim-rpc/openim-rpc-msg/main.go +++ b/cmd/openim-rpc/openim-rpc-msg/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-third/main.go b/cmd/openim-rpc/openim-rpc-third/main.go index fcead5f897..187642d8c3 100644 --- a/cmd/openim-rpc/openim-rpc-third/main.go +++ b/cmd/openim-rpc/openim-rpc-third/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/cmd/openim-rpc/openim-rpc-user/main.go b/cmd/openim-rpc/openim-rpc-user/main.go index 75ab902914..208eb71ebd 100644 --- a/cmd/openim-rpc/openim-rpc-user/main.go +++ b/cmd/openim-rpc/openim-rpc-user/main.go @@ -15,8 +15,9 @@ package main import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" ) func main() { diff --git a/internal/api/auth.go b/internal/api/auth.go index f41b530bf1..16bf590f05 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -16,9 +16,11 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/auth" "github.com/openimsdk/tools/a2r" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type AuthApi rpcclient.Auth diff --git a/internal/api/conversation.go b/internal/api/conversation.go index 8e3a3ca82d..516cf2252a 100644 --- a/internal/api/conversation.go +++ b/internal/api/conversation.go @@ -16,9 +16,11 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/tools/a2r" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type ConversationApi rpcclient.Conversation diff --git a/internal/api/custom_validator.go b/internal/api/custom_validator.go index 99c84f0746..744a39a18e 100644 --- a/internal/api/custom_validator.go +++ b/internal/api/custom_validator.go @@ -16,6 +16,7 @@ package api import ( "github.com/go-playground/validator/v10" + "github.com/openimsdk/protocol/constant" ) diff --git a/internal/api/friend.go b/internal/api/friend.go index d000cccddb..aedb9370d2 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -17,9 +17,10 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/relation" "github.com/openimsdk/tools/a2r" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type FriendApi rpcclient.Friend diff --git a/internal/api/group.go b/internal/api/group.go index 9c35da7081..2898ad76c3 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -16,9 +16,11 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/group" "github.com/openimsdk/tools/a2r" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type GroupApi rpcclient.Group diff --git a/internal/api/init.go b/internal/api/init.go index e83dfc2ea5..6c24d55acd 100644 --- a/internal/api/init.go +++ b/internal/api/init.go @@ -17,9 +17,6 @@ package api import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/tools/utils/datautil" - "github.com/openimsdk/tools/utils/network" "net" "net/http" "os" @@ -28,12 +25,16 @@ import ( "syscall" "time" - kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/tools/utils/network" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" ) type Config struct { diff --git a/internal/api/jssdk/jssdk.go b/internal/api/jssdk/jssdk.go index 2fcbf5ec66..ad2cef6571 100644 --- a/internal/api/jssdk/jssdk.go +++ b/internal/api/jssdk/jssdk.go @@ -2,7 +2,10 @@ package jssdk import ( "context" + "sort" + "github.com/gin-gonic/gin" + "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/protocol/group" "github.com/openimsdk/protocol/jssdk" @@ -12,7 +15,6 @@ import ( "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" - "sort" ) const ( diff --git a/internal/api/jssdk/tools.go b/internal/api/jssdk/tools.go index c19d8970b6..90c48235c1 100644 --- a/internal/api/jssdk/tools.go +++ b/internal/api/jssdk/tools.go @@ -2,15 +2,17 @@ package jssdk import ( "context" + "io" + "strings" + "github.com/gin-gonic/gin" + "google.golang.org/grpc" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/tools/a2r" "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/checker" "github.com/openimsdk/tools/errs" - "google.golang.org/grpc" - "google.golang.org/protobuf/proto" - "io" - "strings" ) func field[A, B, C any](ctx context.Context, fn func(ctx context.Context, req *A, opts ...grpc.CallOption) (*B, error), req *A, get func(*B) C) (C, error) { diff --git a/internal/api/msg.go b/internal/api/msg.go index ce94b5f4fd..e332364dc6 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -18,10 +18,7 @@ import ( "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" "github.com/mitchellh/mapstructure" - "github.com/openimsdk/open-im-server/v3/pkg/apistruct" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" @@ -34,6 +31,11 @@ import ( "github.com/openimsdk/tools/utils/idutil" "github.com/openimsdk/tools/utils/jsonutil" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/apistruct" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type MessageApi struct { diff --git a/internal/api/router.go b/internal/api/router.go index 8e4d17ef1a..7d75539c29 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -2,28 +2,26 @@ package api import ( "fmt" - - "github.com/openimsdk/open-im-server/v3/internal/api/jssdk" + "net/http" + "strings" "github.com/gin-contrib/gzip" - "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/go-playground/validator/v10" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "net/http" - "strings" - - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mw" + + "github.com/openimsdk/open-im-server/v3/internal/api/jssdk" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) const ( diff --git a/internal/api/statistics.go b/internal/api/statistics.go index f5ee99f733..14ee875957 100644 --- a/internal/api/statistics.go +++ b/internal/api/statistics.go @@ -16,9 +16,11 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/a2r" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type StatisticsApi rpcclient.User diff --git a/internal/api/third.go b/internal/api/third.go index 6baa70ee5d..2ac677b552 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -16,7 +16,6 @@ package api import ( "context" - "google.golang.org/grpc" "math/rand" "net/http" "net/url" @@ -24,11 +23,14 @@ import ( "strings" "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/a2r" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/mcontext" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type ThirdApi rpcclient.Third diff --git a/internal/api/user.go b/internal/api/user.go index b499f71dc2..c7f8ab851d 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -16,7 +16,7 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msggateway" "github.com/openimsdk/protocol/user" @@ -24,6 +24,8 @@ import ( "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type UserApi rpcclient.User diff --git a/internal/msggateway/callback.go b/internal/msggateway/callback.go index 1750f779bf..79a5f9b1f8 100644 --- a/internal/msggateway/callback.go +++ b/internal/msggateway/callback.go @@ -18,10 +18,11 @@ import ( "context" "time" - cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/mcontext" + + cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) func (ws *WsServer) webhookAfterUserOnline(ctx context.Context, after *config.AfterConfig, userID string, platformID int, isAppBackground bool, connID string) { diff --git a/internal/msggateway/client.go b/internal/msggateway/client.go index 0da7d72208..d545c305c2 100644 --- a/internal/msggateway/client.go +++ b/internal/msggateway/client.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/openimsdk/tools/mw" "runtime/debug" "sync" "sync/atomic" @@ -26,14 +25,16 @@ import ( "google.golang.org/protobuf/proto" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" + "github.com/openimsdk/tools/mw" "github.com/openimsdk/tools/utils/stringutil" + + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" ) var ( diff --git a/internal/msggateway/compressor_test.go b/internal/msggateway/compressor_test.go index 952bd4d95b..4f3332524a 100644 --- a/internal/msggateway/compressor_test.go +++ b/internal/msggateway/compressor_test.go @@ -16,10 +16,11 @@ package msggateway import ( "crypto/rand" - "github.com/stretchr/testify/assert" "sync" "testing" "unsafe" + + "github.com/stretchr/testify/assert" ) func mockRandom() []byte { diff --git a/internal/msggateway/context.go b/internal/msggateway/context.go index d73a96df4c..9c7c941043 100644 --- a/internal/msggateway/context.go +++ b/internal/msggateway/context.go @@ -15,7 +15,6 @@ package msggateway import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "net/http" "net/url" "strconv" @@ -25,6 +24,8 @@ import ( "github.com/openimsdk/tools/utils/encrypt" "github.com/openimsdk/tools/utils/stringutil" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) type UserConnContext struct { diff --git a/internal/msggateway/hub_server.go b/internal/msggateway/hub_server.go index 04376b27f1..1af88295ea 100644 --- a/internal/msggateway/hub_server.go +++ b/internal/msggateway/hub_server.go @@ -18,10 +18,8 @@ import ( "context" "sync/atomic" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msggateway" "github.com/openimsdk/protocol/sdkws" @@ -31,7 +29,11 @@ import ( "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/mq/memamq" "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) func (s *Server) InitServer(ctx context.Context, config *Config, disCov discovery.SvcDiscoveryRegistry, server *grpc.Server) error { diff --git a/internal/msggateway/init.go b/internal/msggateway/init.go index 77bccc88cf..e68649cc56 100644 --- a/internal/msggateway/init.go +++ b/internal/msggateway/init.go @@ -16,13 +16,14 @@ package msggateway import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" - "github.com/openimsdk/tools/db/redisutil" - "github.com/openimsdk/tools/utils/datautil" "time" + "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" ) type Config struct { diff --git a/internal/msggateway/long_conn.go b/internal/msggateway/long_conn.go index c1b3e27c93..c2bfa8090d 100644 --- a/internal/msggateway/long_conn.go +++ b/internal/msggateway/long_conn.go @@ -19,9 +19,9 @@ import ( "net/http" "time" - "github.com/openimsdk/tools/apiresp" - "github.com/gorilla/websocket" + + "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/errs" ) diff --git a/internal/msggateway/message_handler.go b/internal/msggateway/message_handler.go index 5407ba90cb..393e2e939b 100644 --- a/internal/msggateway/message_handler.go +++ b/internal/msggateway/message_handler.go @@ -22,14 +22,15 @@ import ( "github.com/go-playground/validator/v10" "google.golang.org/protobuf/proto" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/push" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/utils/jsonutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) const ( diff --git a/internal/msggateway/online.go b/internal/msggateway/online.go index f29869b6e5..d8ed398278 100644 --- a/internal/msggateway/online.go +++ b/internal/msggateway/online.go @@ -5,16 +5,18 @@ import ( "crypto/md5" "encoding/binary" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - pbuser "github.com/openimsdk/protocol/user" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/mcontext" - "github.com/openimsdk/tools/utils/datautil" "math/rand" "os" "strconv" "sync/atomic" "time" + + pbuser "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" + "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" ) func (ws *WsServer) ChangeOnlineStatus(concurrent int) { diff --git a/internal/msggateway/subscription.go b/internal/msggateway/subscription.go index 9bb41e0dfd..20ae4ed4c4 100644 --- a/internal/msggateway/subscription.go +++ b/internal/msggateway/subscription.go @@ -2,11 +2,13 @@ package msggateway import ( "context" + "sync" + + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/protobuf/proto" - "sync" ) func (ws *WsServer) subscriberUserOnlineStatusChanges(ctx context.Context, userID string, platformIDs []int32) { diff --git a/internal/msggateway/user_map.go b/internal/msggateway/user_map.go index 5baa4f9012..6828a7e7c7 100644 --- a/internal/msggateway/user_map.go +++ b/internal/msggateway/user_map.go @@ -1,9 +1,10 @@ package msggateway import ( - "github.com/openimsdk/tools/utils/datautil" "sync" "time" + + "github.com/openimsdk/tools/utils/datautil" ) type UserMap interface { diff --git a/internal/msggateway/ws_server.go b/internal/msggateway/ws_server.go index e6b4f3fa47..536d1aaa99 100644 --- a/internal/msggateway/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -3,26 +3,28 @@ package msggateway import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" - pbAuth "github.com/openimsdk/protocol/auth" - "github.com/openimsdk/tools/mcontext" "net/http" "sync" "sync/atomic" "time" "github.com/go-playground/validator/v10" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "golang.org/x/sync/errgroup" + + pbAuth "github.com/openimsdk/protocol/auth" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msggateway" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/stringutil" - "golang.org/x/sync/errgroup" + + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type LongConnServer interface { diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 92053931ce..f2a0549aea 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -23,23 +23,24 @@ import ( "os/signal" "syscall" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mw" + "github.com/openimsdk/tools/system/program" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/open-im-server/v3/pkg/common/config" discRegister "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/mw" - "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) type MsgTransfer struct { diff --git a/internal/msgtransfer/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go index 4a5d5ba89e..8e9055a073 100644 --- a/internal/msgtransfer/online_history_msg_handler.go +++ b/internal/msgtransfer/online_history_msg_handler.go @@ -18,8 +18,6 @@ import ( "context" "encoding/json" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/tools/mw" "strconv" "strings" "sync" @@ -27,19 +25,23 @@ import ( "github.com/IBM/sarama" "github.com/go-redis/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/open-im-server/v3/pkg/tools/batcher" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/mq/kafka" + "github.com/openimsdk/tools/mw" "github.com/openimsdk/tools/utils/stringutil" - "google.golang.org/protobuf/proto" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/open-im-server/v3/pkg/tools/batcher" ) const ( diff --git a/internal/msgtransfer/online_msg_to_mongo_handler.go b/internal/msgtransfer/online_msg_to_mongo_handler.go index 82002c26b9..f31563ece7 100644 --- a/internal/msgtransfer/online_msg_to_mongo_handler.go +++ b/internal/msgtransfer/online_msg_to_mongo_handler.go @@ -18,13 +18,15 @@ import ( "context" "github.com/IBM/sarama" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "google.golang.org/protobuf/proto" + pbmsg "github.com/openimsdk/protocol/msg" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mq/kafka" - "google.golang.org/protobuf/proto" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" ) type OnlineHistoryMongoConsumerHandler struct { diff --git a/internal/push/callback.go b/internal/push/callback.go index f8e17bb8c0..8960634a2a 100644 --- a/internal/push/callback.go +++ b/internal/push/callback.go @@ -17,13 +17,14 @@ package push import ( "context" "encoding/json" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" - "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/mcontext" + + "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" ) func (c *ConsumerHandler) webhookBeforeOfflinePush(ctx context.Context, before *config.BeforeConfig, userIDs []string, msg *sdkws.MsgData, offlinePushUserIDs *[]string) error { diff --git a/internal/push/offlinepush/dummy/push.go b/internal/push/offlinepush/dummy/push.go index 0bccaf4a40..8e4a58b108 100644 --- a/internal/push/offlinepush/dummy/push.go +++ b/internal/push/offlinepush/dummy/push.go @@ -16,8 +16,10 @@ package dummy import ( "context" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" + "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" ) func NewClient() *Dummy { diff --git a/internal/push/offlinepush/fcm/push.go b/internal/push/offlinepush/fcm/push.go index 6e8355af39..2757a6e93f 100644 --- a/internal/push/offlinepush/fcm/push.go +++ b/internal/push/offlinepush/fcm/push.go @@ -17,19 +17,21 @@ package fcm import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" - "github.com/openimsdk/tools/utils/httputil" "path/filepath" "strings" firebase "firebase.google.com/go/v4" "firebase.google.com/go/v4/messaging" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/tools/errs" "github.com/redis/go-redis/v9" "google.golang.org/api/option" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/utils/httputil" + + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" ) const SinglePushCountLimit = 400 diff --git a/internal/push/offlinepush/getui/push.go b/internal/push/offlinepush/getui/push.go index e266f9c464..f20a1e153c 100644 --- a/internal/push/offlinepush/getui/push.go +++ b/internal/push/offlinepush/getui/push.go @@ -22,15 +22,17 @@ import ( "sync" "time" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/redis/go-redis/v9" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/httputil" "github.com/openimsdk/tools/utils/splitter" - "github.com/redis/go-redis/v9" + + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" ) var ( diff --git a/internal/push/offlinepush/jpush/body/platform.go b/internal/push/offlinepush/jpush/body/platform.go index 5654165fa4..0eb042d3be 100644 --- a/internal/push/offlinepush/jpush/body/platform.go +++ b/internal/push/offlinepush/jpush/body/platform.go @@ -15,9 +15,8 @@ package body import ( - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/errs" ) const ( diff --git a/internal/push/offlinepush/jpush/push.go b/internal/push/offlinepush/jpush/push.go index 2694902f20..b5d7c8a72e 100644 --- a/internal/push/offlinepush/jpush/push.go +++ b/internal/push/offlinepush/jpush/push.go @@ -19,10 +19,11 @@ import ( "encoding/base64" "fmt" + "github.com/openimsdk/tools/utils/httputil" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/jpush/body" "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/tools/utils/httputil" ) type JPush struct { diff --git a/internal/push/offlinepush/offlinepusher.go b/internal/push/offlinepush/offlinepusher.go index 17d5d7071b..7e98c3f934 100644 --- a/internal/push/offlinepush/offlinepusher.go +++ b/internal/push/offlinepush/offlinepusher.go @@ -16,6 +16,8 @@ package offlinepush import ( "context" + "strings" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/dummy" "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/fcm" "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/getui" @@ -23,7 +25,6 @@ import ( "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "strings" ) const ( diff --git a/internal/push/offlinepush_handler.go b/internal/push/offlinepush_handler.go index 5c69da0054..a06bde60b6 100644 --- a/internal/push/offlinepush_handler.go +++ b/internal/push/offlinepush_handler.go @@ -4,9 +4,8 @@ import ( "context" "github.com/IBM/sarama" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/constant" pbpush "github.com/openimsdk/protocol/push" "github.com/openimsdk/protocol/sdkws" @@ -14,7 +13,10 @@ import ( "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mq/kafka" "github.com/openimsdk/tools/utils/jsonutil" - "google.golang.org/protobuf/proto" + + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" ) type OfflinePushConsumerHandler struct { diff --git a/internal/push/onlinepusher.go b/internal/push/onlinepusher.go index 9521a84a07..3065847577 100644 --- a/internal/push/onlinepusher.go +++ b/internal/push/onlinepusher.go @@ -2,14 +2,16 @@ package push import ( "context" + "sync" + + "golang.org/x/sync/errgroup" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/msggateway" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc" - "sync" ) type OnlinePusher interface { diff --git a/internal/push/push.go b/internal/push/push.go index 7f14bced7b..eaaa490017 100644 --- a/internal/push/push.go +++ b/internal/push/push.go @@ -3,14 +3,16 @@ package push import ( "context" + "google.golang.org/grpc" + + pbpush "github.com/openimsdk/protocol/push" + "github.com/openimsdk/tools/db/redisutil" + "github.com/openimsdk/tools/discovery" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - pbpush "github.com/openimsdk/protocol/push" - "github.com/openimsdk/tools/db/redisutil" - "github.com/openimsdk/tools/discovery" - "google.golang.org/grpc" ) type pushServer struct { diff --git a/internal/push/push_handler.go b/internal/push/push_handler.go index c1d1ac2f94..5ed0c25bc8 100644 --- a/internal/push/push_handler.go +++ b/internal/push/push_handler.go @@ -3,21 +3,14 @@ package push import ( "context" "encoding/json" - "math/rand" "strconv" "time" "github.com/IBM/sarama" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" - "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" + "github.com/redis/go-redis/v9" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msggateway" pbpush "github.com/openimsdk/protocol/push" @@ -29,8 +22,16 @@ import ( "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/jsonutil" "github.com/openimsdk/tools/utils/timeutil" - "github.com/redis/go-redis/v9" - "google.golang.org/protobuf/proto" + + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush" + "github.com/openimsdk/open-im-server/v3/internal/push/offlinepush/options" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" ) type ConsumerHandler struct { @@ -414,7 +415,7 @@ func (c *ConsumerHandler) DeleteMemberAndSetConversationSeq(ctx context.Context, if err != nil { return err } - + return c.conversationRpcClient.SetConversationMaxSeq(ctx, userIDs, conversationID, maxSeq) } diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index f0f4a022d4..e7b8e108c5 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -18,25 +18,26 @@ import ( "context" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - redis2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/tools/db/redisutil" - "github.com/openimsdk/tools/utils/datautil" "github.com/redis/go-redis/v9" + "google.golang.org/grpc" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" pbauth "github.com/openimsdk/protocol/auth" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msggateway" + "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/tokenverify" - "google.golang.org/grpc" + "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + redis2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type authServer struct { diff --git a/internal/rpc/conversation/conversation.go b/internal/rpc/conversation/conversation.go index 0b6b656a4f..44bac912c3 100644 --- a/internal/rpc/conversation/conversation.go +++ b/internal/rpc/conversation/conversation.go @@ -19,27 +19,28 @@ import ( "sort" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - dbModel "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "github.com/openimsdk/tools/db/redisutil" + "google.golang.org/grpc" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/constant" pbconversation "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + dbModel "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type conversationServer struct { diff --git a/internal/rpc/conversation/notification.go b/internal/rpc/conversation/notification.go index 994e1d57ae..329588a0d9 100644 --- a/internal/rpc/conversation/notification.go +++ b/internal/rpc/conversation/notification.go @@ -17,10 +17,11 @@ package conversation import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type ConversationNotificationSender struct { diff --git a/internal/rpc/conversation/sync.go b/internal/rpc/conversation/sync.go index ad88b2bbd5..b471a96e65 100644 --- a/internal/rpc/conversation/sync.go +++ b/internal/rpc/conversation/sync.go @@ -3,10 +3,11 @@ package conversation import ( "context" + "github.com/openimsdk/protocol/conversation" + "github.com/openimsdk/open-im-server/v3/internal/rpc/incrversion" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/open-im-server/v3/pkg/util/hashutil" - "github.com/openimsdk/protocol/conversation" ) func (c *conversationServer) GetFullOwnerConversationIDs(ctx context.Context, req *conversation.GetFullOwnerConversationIDsReq) (*conversation.GetFullOwnerConversationIDsResp, error) { diff --git a/internal/rpc/group/cache.go b/internal/rpc/group/cache.go index 022a0f4ef6..dfe2192129 100644 --- a/internal/rpc/group/cache.go +++ b/internal/rpc/group/cache.go @@ -17,8 +17,9 @@ package group import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" pbgroup "github.com/openimsdk/protocol/group" + + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" ) // GetGroupInfoCache get group info from cache. diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go index 559d64ff47..ae68c755ed 100644 --- a/internal/rpc/group/callback.go +++ b/internal/rpc/group/callback.go @@ -18,17 +18,18 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/apistruct" - "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/group" "github.com/openimsdk/protocol/wrapperspb" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/apistruct" + "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" ) // CallbackBeforeCreateGroup callback before create group. diff --git a/internal/rpc/group/convert.go b/internal/rpc/group/convert.go index 8026430c30..a9e5fde55b 100644 --- a/internal/rpc/group/convert.go +++ b/internal/rpc/group/convert.go @@ -15,8 +15,9 @@ package group import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func (s *groupServer) groupDB2PB(group *model.Group, ownerUserID string, memberCount uint32) *sdkws.GroupInfo { diff --git a/internal/rpc/group/fill.go b/internal/rpc/group/fill.go index 1c86481df8..4c3ad1043d 100644 --- a/internal/rpc/group/fill.go +++ b/internal/rpc/group/fill.go @@ -16,6 +16,7 @@ package group import ( "context" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index ba0c8a42de..1641fd63f1 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -23,22 +23,8 @@ import ( "strings" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "google.golang.org/grpc" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/grouphash" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" "github.com/openimsdk/protocol/constant" pbconversation "github.com/openimsdk/protocol/conversation" pbgroup "github.com/openimsdk/protocol/group" @@ -53,7 +39,22 @@ import ( "github.com/openimsdk/tools/mw/specialerror" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/encrypt" - "google.golang.org/grpc" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/grouphash" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" ) type groupServer struct { diff --git a/internal/rpc/group/notification.go b/internal/rpc/group/notification.go index 54a6146f54..7e5748a345 100644 --- a/internal/rpc/group/notification.go +++ b/internal/rpc/group/notification.go @@ -18,6 +18,20 @@ import ( "context" "errors" "fmt" + "time" + + "go.mongodb.org/mongo-driver/mongo" + + "github.com/openimsdk/protocol/constant" + pbgroup "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/tools/utils/stringutil" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/convert" "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" @@ -28,17 +42,6 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" - "github.com/openimsdk/protocol/constant" - pbgroup "github.com/openimsdk/protocol/group" - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/mcontext" - "github.com/openimsdk/tools/utils/datautil" - "github.com/openimsdk/tools/utils/stringutil" - "go.mongodb.org/mongo-driver/mongo" - "time" ) // GroupApplicationReceiver diff --git a/internal/rpc/group/sync.go b/internal/rpc/group/sync.go index 0592aa811c..dcf59706dd 100644 --- a/internal/rpc/group/sync.go +++ b/internal/rpc/group/sync.go @@ -3,16 +3,17 @@ package group import ( "context" - "github.com/openimsdk/open-im-server/v3/internal/rpc/incrversion" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/util/hashutil" "github.com/openimsdk/protocol/constant" pbgroup "github.com/openimsdk/protocol/group" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/internal/rpc/incrversion" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/util/hashutil" ) func (s *groupServer) GetFullGroupMemberUserIDs(ctx context.Context, req *pbgroup.GetFullGroupMemberUserIDsReq) (*pbgroup.GetFullGroupMemberUserIDsResp, error) { diff --git a/internal/rpc/incrversion/batch_option.go b/internal/rpc/incrversion/batch_option.go index 34d1b25066..e45921ced0 100644 --- a/internal/rpc/incrversion/batch_option.go +++ b/internal/rpc/incrversion/batch_option.go @@ -4,9 +4,11 @@ import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/bson/primitive" + + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type BatchOption[A, B any] struct { diff --git a/internal/rpc/incrversion/option.go b/internal/rpc/incrversion/option.go index af1200d5c0..0cdf21fc6e 100644 --- a/internal/rpc/incrversion/option.go +++ b/internal/rpc/incrversion/option.go @@ -4,9 +4,11 @@ import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/bson/primitive" + + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) //func Limit(maxSync int, version uint64) int { diff --git a/internal/rpc/msg/as_read.go b/internal/rpc/msg/as_read.go index de1879438b..2969f8d8a9 100644 --- a/internal/rpc/msg/as_read.go +++ b/internal/rpc/msg/as_read.go @@ -18,14 +18,16 @@ import ( "context" "errors" - cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/redis/go-redis/v9" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" + + cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" ) func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (*msg.GetConversationsHasReadAndMaxSeqResp, error) { diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index c66dd6ca91..2d6872dbd2 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -16,16 +16,18 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" - cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/constant" pbchat "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/protobuf/proto" + + cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" ) func toCommonCallback(ctx context.Context, msg *pbchat.SendMsgReq, command string) cbapi.CommonCallbackReq { diff --git a/internal/rpc/msg/clear.go b/internal/rpc/msg/clear.go index ff732136a9..1521f51662 100644 --- a/internal/rpc/msg/clear.go +++ b/internal/rpc/msg/clear.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "golang.org/x/sync/errgroup" + pbconversation "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/wrapperspb" @@ -15,7 +15,9 @@ import ( "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/idutil" "github.com/openimsdk/tools/utils/stringutil" - "golang.org/x/sync/errgroup" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" ) // hard delete in Database. diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go index e19bba867e..7a8d99825e 100644 --- a/internal/rpc/msg/delete.go +++ b/internal/rpc/msg/delete.go @@ -17,13 +17,14 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" ) func (m *msgServer) getMinSeqs(maxSeqs map[string]int64) map[string]int64 { diff --git a/internal/rpc/msg/filter.go b/internal/rpc/msg/filter.go index ed1a488f12..b3ead97c98 100644 --- a/internal/rpc/msg/filter.go +++ b/internal/rpc/msg/filter.go @@ -1,11 +1,13 @@ package msg import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - pbchat "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/tools/utils/datautil" "strconv" "strings" + + pbchat "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) const ( diff --git a/internal/rpc/msg/notification.go b/internal/rpc/msg/notification.go index 26e3c7f46a..4200b81af3 100644 --- a/internal/rpc/msg/notification.go +++ b/internal/rpc/msg/notification.go @@ -17,9 +17,10 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type MsgNotificationSender struct { diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index b7cc7df62e..f5281373d2 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -17,11 +17,8 @@ package msg import ( "context" "encoding/json" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" @@ -29,6 +26,10 @@ import ( "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.RevokeMsgResp, error) { diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go index 2cbbcd1fc2..95cb11f12a 100644 --- a/internal/rpc/msg/send.go +++ b/internal/rpc/msg/send.go @@ -16,11 +16,7 @@ package msg import ( "context" - "github.com/openimsdk/tools/mw" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" "github.com/openimsdk/protocol/constant" pbconversation "github.com/openimsdk/protocol/conversation" pbmsg "github.com/openimsdk/protocol/msg" @@ -29,7 +25,12 @@ import ( "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" + "github.com/openimsdk/tools/mw" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" ) func (m *msgServer) SendMsg(ctx context.Context, req *pbmsg.SendMsgReq) (*pbmsg.SendMsgResp, error) { diff --git a/internal/rpc/msg/seq.go b/internal/rpc/msg/seq.go index 7f5fa1adb4..997e927327 100644 --- a/internal/rpc/msg/seq.go +++ b/internal/rpc/msg/seq.go @@ -17,9 +17,11 @@ package msg import ( "context" "errors" - pbmsg "github.com/openimsdk/protocol/msg" - "github.com/redis/go-redis/v9" "sort" + + "github.com/redis/go-redis/v9" + + pbmsg "github.com/openimsdk/protocol/msg" ) func (m *msgServer) GetConversationMaxSeq(ctx context.Context, req *pbmsg.GetConversationMaxSeqReq) (*pbmsg.GetConversationMaxSeqResp, error) { diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 6d5922ce3a..2eb5762119 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -17,22 +17,23 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + "google.golang.org/grpc" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/protocol/conversation" + "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" + "github.com/openimsdk/tools/discovery" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/conversation" - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/tools/discovery" - "google.golang.org/grpc" ) type MessageInterceptorFunc func(ctx context.Context, globalConfig *Config, req *msg.SendMsgReq) (*sdkws.MsgData, error) diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go index 01c0f1c46c..b280cd431f 100644 --- a/internal/rpc/msg/statistics.go +++ b/internal/rpc/msg/statistics.go @@ -16,12 +16,13 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func (m *msgServer) GetActiveUser(ctx context.Context, req *msg.GetActiveUserReq) (*msg.GetActiveUserResp, error) { diff --git a/internal/rpc/msg/stream_msg.go b/internal/rpc/msg/stream_msg.go index 5db2aad48e..30ee8e1391 100644 --- a/internal/rpc/msg/stream_msg.go +++ b/internal/rpc/msg/stream_msg.go @@ -3,13 +3,15 @@ package msg import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "time" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" - "time" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" ) const StreamDeadlineTime = time.Second * 60 * 10 diff --git a/internal/rpc/msg/sync_msg.go b/internal/rpc/msg/sync_msg.go index 2f77881673..f07fbaaac7 100644 --- a/internal/rpc/msg/sync_msg.go +++ b/internal/rpc/msg/sync_msg.go @@ -17,15 +17,16 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/util/conversationutil" ) func (m *msgServer) PullMessageBySeqs(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) { diff --git a/internal/rpc/msg/utils.go b/internal/rpc/msg/utils.go index e3490848c9..e477e28eab 100644 --- a/internal/rpc/msg/utils.go +++ b/internal/rpc/msg/utils.go @@ -15,10 +15,11 @@ package msg import ( - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/tools/errs" "github.com/redis/go-redis/v9" "go.mongodb.org/mongo-driver/mongo" + + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/tools/errs" ) func IsNotFound(err error) bool { diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index f6c3147ba0..f3d120d63b 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -16,10 +16,6 @@ package msg import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/tools/utils/datautil" - "github.com/openimsdk/tools/utils/encrypt" - "github.com/openimsdk/tools/utils/timeutil" "math/rand" "strconv" "time" @@ -28,6 +24,11 @@ import ( "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/tools/utils/encrypt" + "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) var ExcludeContentType = []int{constant.HasReadReceipt} diff --git a/internal/rpc/relation/black.go b/internal/rpc/relation/black.go index d8d457dacc..4524a591ed 100644 --- a/internal/rpc/relation/black.go +++ b/internal/rpc/relation/black.go @@ -18,15 +18,15 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" "github.com/openimsdk/protocol/relation" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *relation.GetPaginationBlacksReq) (resp *relation.GetPaginationBlacksResp, err error) { diff --git a/internal/rpc/relation/callback.go b/internal/rpc/relation/callback.go index 09debdea18..a6986056b6 100644 --- a/internal/rpc/relation/callback.go +++ b/internal/rpc/relation/callback.go @@ -17,11 +17,11 @@ package relation import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + "github.com/openimsdk/protocol/relation" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" ) func (s *friendServer) webhookAfterDeleteFriend(ctx context.Context, after *config.AfterConfig, req *relation.DeleteFriendReq) { diff --git a/internal/rpc/relation/friend.go b/internal/rpc/relation/friend.go index 036c7aff58..c32ae2bdc5 100644 --- a/internal/rpc/relation/friend.go +++ b/internal/rpc/relation/friend.go @@ -17,29 +17,29 @@ package relation import ( "context" + "google.golang.org/grpc" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/redisutil" + "github.com/openimsdk/tools/discovery" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/mq/memamq" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "github.com/openimsdk/tools/db/redisutil" - - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/relation" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/discovery" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc" ) type friendServer struct { diff --git a/internal/rpc/relation/notification.go b/internal/rpc/relation/notification.go index 83c5d2ca9d..411e61bcee 100644 --- a/internal/rpc/relation/notification.go +++ b/internal/rpc/relation/notification.go @@ -16,20 +16,20 @@ package relation import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/convert" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/relation" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/mcontext" ) type FriendNotificationSender struct { diff --git a/internal/rpc/relation/sync.go b/internal/rpc/relation/sync.go index 0ad94fe825..ff696b32e2 100644 --- a/internal/rpc/relation/sync.go +++ b/internal/rpc/relation/sync.go @@ -2,15 +2,16 @@ package relation import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/util/hashutil" + "slices" + + "github.com/openimsdk/protocol/relation" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" - "slices" "github.com/openimsdk/open-im-server/v3/internal/rpc/incrversion" "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/open-im-server/v3/pkg/util/hashutil" ) func (s *friendServer) NotificationUserInfoUpdate(ctx context.Context, req *relation.NotificationUserInfoUpdateReq) (*relation.NotificationUserInfoUpdateResp, error) { diff --git a/internal/rpc/third/log.go b/internal/rpc/third/log.go index 657ea16893..b75bff9097 100644 --- a/internal/rpc/third/log.go +++ b/internal/rpc/third/log.go @@ -19,14 +19,14 @@ import ( "crypto/rand" "time" - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func genLogID() string { diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go index b4b064d7f4..50ce4be1b5 100644 --- a/internal/rpc/third/s3.go +++ b/internal/rpc/third/s3.go @@ -23,12 +23,9 @@ import ( "strconv" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/google/uuid" "go.mongodb.org/mongo-driver/mongo" - "github.com/google/uuid" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/errs" @@ -37,6 +34,10 @@ import ( "github.com/openimsdk/tools/s3" "github.com/openimsdk/tools/s3/cont" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func (t *thirdServer) PartLimit(ctx context.Context, req *third.PartLimitReq) (*third.PartLimitResp, error) { diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index 4206a2d6f5..87f8cba32b 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -17,14 +17,10 @@ package third import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" @@ -34,7 +30,13 @@ import ( "github.com/openimsdk/tools/s3/kodo" "github.com/openimsdk/tools/s3/minio" "github.com/openimsdk/tools/s3/oss" - "google.golang.org/grpc" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) type thirdServer struct { diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go index 4e22ffbf97..a5598855e8 100644 --- a/internal/rpc/third/tool.go +++ b/internal/rpc/third/tool.go @@ -20,10 +20,11 @@ import ( "strings" "unicode/utf8" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/mcontext" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" ) func toPbMapArray(m map[string][]string) []*third.KeyValues { diff --git a/internal/rpc/user/callback.go b/internal/rpc/user/callback.go index b58053c5ac..f9f8c10175 100644 --- a/internal/rpc/user/callback.go +++ b/internal/rpc/user/callback.go @@ -17,12 +17,12 @@ package user import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" + pbuser "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/utils/datautil" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" "github.com/openimsdk/open-im-server/v3/pkg/common/config" - pbuser "github.com/openimsdk/protocol/user" + "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" ) func (s *userServer) webhookBeforeUpdateUserInfo(ctx context.Context, before *config.BeforeConfig, req *pbuser.UpdateUserInfoReq) error { diff --git a/internal/rpc/user/notification.go b/internal/rpc/user/notification.go index b992c9d123..b994db84ed 100644 --- a/internal/rpc/user/notification.go +++ b/internal/rpc/user/notification.go @@ -16,13 +16,14 @@ package user import ( "context" - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" ) type UserNotificationSender struct { diff --git a/internal/rpc/user/online.go b/internal/rpc/user/online.go index 0e5365ed93..9316bc9493 100644 --- a/internal/rpc/user/online.go +++ b/internal/rpc/user/online.go @@ -3,10 +3,9 @@ package user import ( "context" - "github.com/openimsdk/tools/utils/datautil" - "github.com/openimsdk/protocol/constant" pbuser "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/utils/datautil" ) func (s *userServer) getUserOnlineStatus(ctx context.Context, userID string) (*pbuser.OnlineStatus, error) { diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 2dfbb01dff..fdc044458a 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -22,33 +22,34 @@ import ( "sync" "time" + "google.golang.org/grpc" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/protocol/group" + friendpb "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/protocol/sdkws" + pbuser "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + "github.com/openimsdk/tools/db/redisutil" + registry "github.com/openimsdk/tools/discovery" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/open-im-server/v3/internal/rpc/relation" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" tablerelation "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/open-im-server/v3/pkg/common/webhook" "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "github.com/openimsdk/protocol/group" - friendpb "github.com/openimsdk/protocol/relation" - "github.com/openimsdk/tools/db/redisutil" - - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/controller" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/sdkws" - pbuser "github.com/openimsdk/protocol/user" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" - registry "github.com/openimsdk/tools/discovery" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc" ) type userServer struct { diff --git a/internal/tools/cron_task.go b/internal/tools/cron_task.go index 4f87036c7f..aef3bcfe48 100644 --- a/internal/tools/cron_task.go +++ b/internal/tools/cron_task.go @@ -20,20 +20,20 @@ import ( "os" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" + "github.com/robfig/cron/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + pbconversation "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/third" - + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/mw" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/robfig/cron/v3" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" ) type CronTaskConfig struct { diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index f1b377bad7..63bb153837 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -19,9 +19,11 @@ import ( "fmt" "github.com/golang-jwt/jwt/v4" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) func Secret(secret string) jwt.Keyfunc { diff --git a/pkg/callbackstruct/common.go b/pkg/callbackstruct/common.go index 9d6a325a8d..c0c100fc57 100644 --- a/pkg/callbackstruct/common.go +++ b/pkg/callbackstruct/common.go @@ -15,8 +15,9 @@ package callbackstruct import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) const ( diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index 1f9b848cf9..92f3a7f66d 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -15,9 +15,10 @@ package callbackstruct import ( - "github.com/openimsdk/open-im-server/v3/pkg/apistruct" common "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/protocol/wrapperspb" + + "github.com/openimsdk/open-im-server/v3/pkg/apistruct" ) type CallbackCommand string diff --git a/pkg/common/cmd/api.go b/pkg/common/cmd/api.go index 4088ecd09d..9caf39087a 100644 --- a/pkg/common/cmd/api.go +++ b/pkg/common/cmd/api.go @@ -17,10 +17,12 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/api" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type ApiCmd struct { diff --git a/pkg/common/cmd/auth.go b/pkg/common/cmd/auth.go index f8232bc260..b0c4cd3a4c 100644 --- a/pkg/common/cmd/auth.go +++ b/pkg/common/cmd/auth.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/auth" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type AuthRpcCmd struct { diff --git a/pkg/common/cmd/conversation.go b/pkg/common/cmd/conversation.go index 6a0da11e5d..00f8492e6d 100644 --- a/pkg/common/cmd/conversation.go +++ b/pkg/common/cmd/conversation.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/conversation" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type ConversationRpcCmd struct { diff --git a/pkg/common/cmd/cron_task.go b/pkg/common/cmd/cron_task.go index d6c5e472e1..24f6d8a0bb 100644 --- a/pkg/common/cmd/cron_task.go +++ b/pkg/common/cmd/cron_task.go @@ -17,10 +17,12 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/tools" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type CronTaskCmd struct { diff --git a/pkg/common/cmd/friend.go b/pkg/common/cmd/friend.go index 2ff25090e9..0c37c401b2 100644 --- a/pkg/common/cmd/friend.go +++ b/pkg/common/cmd/friend.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/relation" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type FriendRpcCmd struct { diff --git a/pkg/common/cmd/group.go b/pkg/common/cmd/group.go index f1757c7fa2..5f90b544ff 100644 --- a/pkg/common/cmd/group.go +++ b/pkg/common/cmd/group.go @@ -17,12 +17,14 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/group" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type GroupRpcCmd struct { diff --git a/pkg/common/cmd/msg.go b/pkg/common/cmd/msg.go index ae718a11d1..1660290a56 100644 --- a/pkg/common/cmd/msg.go +++ b/pkg/common/cmd/msg.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/msg" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type MsgRpcCmd struct { diff --git a/pkg/common/cmd/msg_gateway.go b/pkg/common/cmd/msg_gateway.go index 6363bfbf9e..b5afc903e1 100644 --- a/pkg/common/cmd/msg_gateway.go +++ b/pkg/common/cmd/msg_gateway.go @@ -17,11 +17,12 @@ package cmd import ( "context" - "github.com/openimsdk/open-im-server/v3/internal/msggateway" - "github.com/openimsdk/open-im-server/v3/version" + "github.com/spf13/cobra" "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" + + "github.com/openimsdk/open-im-server/v3/internal/msggateway" + "github.com/openimsdk/open-im-server/v3/version" ) type MsgGatewayCmd struct { diff --git a/pkg/common/cmd/msg_gateway_test.go b/pkg/common/cmd/msg_gateway_test.go index 929abcd863..e60ec2422b 100644 --- a/pkg/common/cmd/msg_gateway_test.go +++ b/pkg/common/cmd/msg_gateway_test.go @@ -18,11 +18,12 @@ import ( "math" "testing" + "github.com/stretchr/testify/mock" + "go.mongodb.org/mongo-driver/bson/primitive" + "github.com/openimsdk/protocol/auth" "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/utils/jsonutil" - "github.com/stretchr/testify/mock" - "go.mongodb.org/mongo-driver/bson/primitive" ) // MockRootCmd is a mock type for the RootCmd type diff --git a/pkg/common/cmd/msg_transfer.go b/pkg/common/cmd/msg_transfer.go index 3643934135..114e2ff643 100644 --- a/pkg/common/cmd/msg_transfer.go +++ b/pkg/common/cmd/msg_transfer.go @@ -17,10 +17,12 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/msgtransfer" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type MsgTransferCmd struct { diff --git a/pkg/common/cmd/push.go b/pkg/common/cmd/push.go index 2f9e248f14..abe344f21a 100644 --- a/pkg/common/cmd/push.go +++ b/pkg/common/cmd/push.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/push" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type PushRpcCmd struct { diff --git a/pkg/common/cmd/root.go b/pkg/common/cmd/root.go index 5edea43773..512fe4d491 100644 --- a/pkg/common/cmd/root.go +++ b/pkg/common/cmd/root.go @@ -18,11 +18,13 @@ import ( "fmt" "path/filepath" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/version" + "github.com/spf13/cobra" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" - "github.com/spf13/cobra" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/version" ) type RootCmd struct { diff --git a/pkg/common/cmd/third.go b/pkg/common/cmd/third.go index fa1d5d42dc..cc3d954bb8 100644 --- a/pkg/common/cmd/third.go +++ b/pkg/common/cmd/third.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/third" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type ThirdRpcCmd struct { diff --git a/pkg/common/cmd/user.go b/pkg/common/cmd/user.go index 8a22bfce91..66484e76ba 100644 --- a/pkg/common/cmd/user.go +++ b/pkg/common/cmd/user.go @@ -17,11 +17,13 @@ package cmd import ( "context" + "github.com/spf13/cobra" + + "github.com/openimsdk/tools/system/program" + "github.com/openimsdk/open-im-server/v3/internal/rpc/user" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/version" - "github.com/openimsdk/tools/system/program" - "github.com/spf13/cobra" ) type UserRpcCmd struct { diff --git a/pkg/common/config/load_config.go b/pkg/common/config/load_config.go index 9272896b45..456370a0c7 100644 --- a/pkg/common/config/load_config.go +++ b/pkg/common/config/load_config.go @@ -1,10 +1,12 @@ package config import ( + "strings" + "github.com/mitchellh/mapstructure" - "github.com/openimsdk/tools/errs" "github.com/spf13/viper" - "strings" + + "github.com/openimsdk/tools/errs" ) func LoadConfig(path string, envPrefix string, config any) error { diff --git a/pkg/common/config/load_config_test.go b/pkg/common/config/load_config_test.go index a0345fc7a5..9fc8ab8afb 100644 --- a/pkg/common/config/load_config_test.go +++ b/pkg/common/config/load_config_test.go @@ -1,8 +1,9 @@ package config import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestLoadLogConfig(t *testing.T) { diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go index 08f82ac7d3..0881738146 100644 --- a/pkg/common/config/parse.go +++ b/pkg/common/config/parse.go @@ -18,11 +18,13 @@ import ( "os" "path/filepath" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "gopkg.in/yaml.v3" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/field" - "gopkg.in/yaml.v3" + + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" ) const ( diff --git a/pkg/common/convert/black.go b/pkg/common/convert/black.go index 6c24051fdb..ec2f86bf3a 100644 --- a/pkg/common/convert/black.go +++ b/pkg/common/convert/black.go @@ -16,10 +16,11 @@ package convert import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/protocol/sdkws" sdk "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func BlackDB2Pb(ctx context.Context, blackDBs []*model.Black, f func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error)) (blackPbs []*sdk.BlackInfo, err error) { diff --git a/pkg/common/convert/conversation.go b/pkg/common/convert/conversation.go index 9389b02524..6e2f877ac6 100644 --- a/pkg/common/convert/conversation.go +++ b/pkg/common/convert/conversation.go @@ -15,9 +15,10 @@ package convert import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func ConversationDB2Pb(conversationDB *model.Conversation) *conversation.Conversation { diff --git a/pkg/common/convert/friend.go b/pkg/common/convert/friend.go index 6d346b0f4a..dda5c048fb 100644 --- a/pkg/common/convert/friend.go +++ b/pkg/common/convert/friend.go @@ -17,12 +17,13 @@ package convert import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/protocol/relation" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func FriendPb2DB(friend *sdkws.FriendInfo) *model.Friend { diff --git a/pkg/common/convert/group.go b/pkg/common/convert/group.go index bc2b2f9985..fa7359af8c 100644 --- a/pkg/common/convert/group.go +++ b/pkg/common/convert/group.go @@ -15,11 +15,12 @@ package convert import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" pbgroup "github.com/openimsdk/protocol/group" sdkws "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func Db2PbGroupInfo(m *model.Group, ownerUserID string, memberCount uint32) *sdkws.GroupInfo { diff --git a/pkg/common/convert/msg.go b/pkg/common/convert/msg.go index 41f6b41f6b..28e3210e92 100644 --- a/pkg/common/convert/msg.go +++ b/pkg/common/convert/msg.go @@ -15,9 +15,10 @@ package convert import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func MsgPb2DB(msg *sdkws.MsgData) *model.MsgDataModel { diff --git a/pkg/common/convert/user.go b/pkg/common/convert/user.go index d824fa68e0..53a678a398 100644 --- a/pkg/common/convert/user.go +++ b/pkg/common/convert/user.go @@ -15,11 +15,12 @@ package convert import ( - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/utils/datautil" "time" "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/utils/datautil" + + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func UserDB2Pb(user *relationtb.User) *sdkws.UserInfo { diff --git a/pkg/common/convert/user_test.go b/pkg/common/convert/user_test.go index be8137265e..4feba2ce35 100644 --- a/pkg/common/convert/user_test.go +++ b/pkg/common/convert/user_test.go @@ -15,11 +15,12 @@ package convert import ( - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "reflect" "testing" "github.com/openimsdk/protocol/sdkws" + + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func TestUsersDB2Pb(t *testing.T) { diff --git a/pkg/common/discoveryregister/direct/direct_resolver.go b/pkg/common/discoveryregister/direct/direct_resolver.go index 8213782772..d69e7b651d 100644 --- a/pkg/common/discoveryregister/direct/direct_resolver.go +++ b/pkg/common/discoveryregister/direct/direct_resolver.go @@ -19,8 +19,9 @@ import ( "math/rand" "strings" - "github.com/openimsdk/tools/log" "google.golang.org/grpc/resolver" + + "github.com/openimsdk/tools/log" ) const ( diff --git a/pkg/common/discoveryregister/discoveryregister.go b/pkg/common/discoveryregister/discoveryregister.go index 559c937c10..9ead58b381 100644 --- a/pkg/common/discoveryregister/discoveryregister.go +++ b/pkg/common/discoveryregister/discoveryregister.go @@ -15,13 +15,15 @@ package discoveryregister import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister/kubernetes" + "time" + "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/discovery/etcd" "github.com/openimsdk/tools/discovery/zookeeper" "github.com/openimsdk/tools/errs" - "time" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister/kubernetes" ) // NewDiscoveryRegister creates a new service discovery and registry client based on the provided environment type. diff --git a/pkg/common/discoveryregister/kubernetes/kubernetes.go b/pkg/common/discoveryregister/kubernetes/kubernetes.go index f1ce0bbdce..8fd20655e4 100644 --- a/pkg/common/discoveryregister/kubernetes/kubernetes.go +++ b/pkg/common/discoveryregister/kubernetes/kubernetes.go @@ -22,10 +22,11 @@ import ( "strconv" "strings" - "github.com/openimsdk/tools/discovery" - "github.com/openimsdk/tools/log" "github.com/stathat/consistent" "google.golang.org/grpc" + + "github.com/openimsdk/tools/discovery" + "github.com/openimsdk/tools/log" ) // K8sDR represents the Kubernetes service discovery and registration client. diff --git a/pkg/common/prommetrics/api.go b/pkg/common/prommetrics/api.go index 95b5c06b68..700ba2aebd 100644 --- a/pkg/common/prommetrics/api.go +++ b/pkg/common/prommetrics/api.go @@ -1,9 +1,10 @@ package prommetrics import ( + "strconv" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" - "strconv" ) var ( diff --git a/pkg/common/prommetrics/prommetrics.go b/pkg/common/prommetrics/prommetrics.go index 02e408d63b..89a375ec04 100644 --- a/pkg/common/prommetrics/prommetrics.go +++ b/pkg/common/prommetrics/prommetrics.go @@ -16,9 +16,10 @@ package prommetrics import ( "fmt" + "net/http" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" - "net/http" ) const commonPath = "/metrics" diff --git a/pkg/common/prommetrics/rpc.go b/pkg/common/prommetrics/rpc.go index 7162fa7e80..be2621bbb7 100644 --- a/pkg/common/prommetrics/rpc.go +++ b/pkg/common/prommetrics/rpc.go @@ -1,11 +1,13 @@ package prommetrics import ( + "strconv" + gp "github.com/grpc-ecosystem/go-grpc-prometheus" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" - "strconv" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) const rpcPath = commonPath diff --git a/pkg/common/startrpc/start.go b/pkg/common/startrpc/start.go index 5c42586bf8..d4e7b3c965 100644 --- a/pkg/common/startrpc/start.go +++ b/pkg/common/startrpc/start.go @@ -17,27 +17,29 @@ package startrpc import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc/status" "net" "net/http" "os" "os/signal" + "strconv" "syscall" "time" - "github.com/openimsdk/open-im-server/v3/internal/tools/addr" - kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" - "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mw" + "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/network" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "strconv" + + "github.com/openimsdk/open-im-server/v3/internal/tools/addr" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" + "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" ) // Start rpc server. diff --git a/pkg/common/storage/cache/cachekey/msg.go b/pkg/common/storage/cache/cachekey/msg.go index 8e05b64f1f..90219612e4 100644 --- a/pkg/common/storage/cache/cachekey/msg.go +++ b/pkg/common/storage/cache/cachekey/msg.go @@ -15,8 +15,9 @@ package cachekey import ( - "github.com/openimsdk/protocol/constant" "strconv" + + "github.com/openimsdk/protocol/constant" ) const ( diff --git a/pkg/common/storage/cache/cachekey/token.go b/pkg/common/storage/cache/cachekey/token.go index 83ba2f2111..964d0a2459 100644 --- a/pkg/common/storage/cache/cachekey/token.go +++ b/pkg/common/storage/cache/cachekey/token.go @@ -1,8 +1,9 @@ package cachekey import ( - "github.com/openimsdk/protocol/constant" "strings" + + "github.com/openimsdk/protocol/constant" ) const ( diff --git a/pkg/common/storage/cache/conversation.go b/pkg/common/storage/cache/conversation.go index ac3011107c..3db562fb2b 100644 --- a/pkg/common/storage/cache/conversation.go +++ b/pkg/common/storage/cache/conversation.go @@ -16,6 +16,7 @@ package cache import ( "context" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) diff --git a/pkg/common/storage/cache/friend.go b/pkg/common/storage/cache/friend.go index b451d36757..9ceb345ace 100644 --- a/pkg/common/storage/cache/friend.go +++ b/pkg/common/storage/cache/friend.go @@ -16,6 +16,7 @@ package cache import ( "context" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) diff --git a/pkg/common/storage/cache/redis/batch.go b/pkg/common/storage/cache/redis/batch.go index 1810ac9939..89fec150ad 100644 --- a/pkg/common/storage/cache/redis/batch.go +++ b/pkg/common/storage/cache/redis/batch.go @@ -3,13 +3,15 @@ package redis import ( "context" "encoding/json" + "time" + "unsafe" + "github.com/dtm-labs/rockscache" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" "github.com/redis/go-redis/v9" "golang.org/x/sync/singleflight" - "time" - "unsafe" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" ) func getRocksCacheRedisClient(cli *rockscache.Client) redis.UniversalClient { diff --git a/pkg/common/storage/cache/redis/batch_handler.go b/pkg/common/storage/cache/redis/batch_handler.go index 420ebdf777..527e3dbbb4 100644 --- a/pkg/common/storage/cache/redis/batch_handler.go +++ b/pkg/common/storage/cache/redis/batch_handler.go @@ -18,14 +18,17 @@ import ( "context" "encoding/json" "fmt" + "time" + "github.com/dtm-labs/rockscache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/redis/go-redis/v9" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" - "time" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" ) const ( diff --git a/pkg/common/storage/cache/redis/batch_test.go b/pkg/common/storage/cache/redis/batch_test.go index bbb6d76f15..7ebf051e60 100644 --- a/pkg/common/storage/cache/redis/batch_test.go +++ b/pkg/common/storage/cache/redis/batch_test.go @@ -2,11 +2,13 @@ package redis import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "testing" + "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" - "testing" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" ) func TestName(t *testing.T) { diff --git a/pkg/common/storage/cache/redis/black.go b/pkg/common/storage/cache/redis/black.go index fac6dbe6fb..8ee83612eb 100644 --- a/pkg/common/storage/cache/redis/black.go +++ b/pkg/common/storage/cache/redis/black.go @@ -16,14 +16,17 @@ package redis import ( "context" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/log" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" - "time" ) const ( diff --git a/pkg/common/storage/cache/redis/conversation.go b/pkg/common/storage/cache/redis/conversation.go index 91d8ed69de..fb0bbd4819 100644 --- a/pkg/common/storage/cache/redis/conversation.go +++ b/pkg/common/storage/cache/redis/conversation.go @@ -16,19 +16,22 @@ package redis import ( "context" + "math/big" + "strings" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/tools/utils/encrypt" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/utils/datautil" - "github.com/openimsdk/tools/utils/encrypt" - "github.com/redis/go-redis/v9" - "math/big" - "strings" - "time" ) const ( diff --git a/pkg/common/storage/cache/redis/friend.go b/pkg/common/storage/cache/redis/friend.go index be4687794f..72233d9d48 100644 --- a/pkg/common/storage/cache/redis/friend.go +++ b/pkg/common/storage/cache/redis/friend.go @@ -19,14 +19,16 @@ import ( "time" "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" ) const ( diff --git a/pkg/common/storage/cache/redis/group.go b/pkg/common/storage/cache/redis/group.go index 736111df31..606f483f1d 100644 --- a/pkg/common/storage/cache/redis/group.go +++ b/pkg/common/storage/cache/redis/group.go @@ -20,16 +20,18 @@ import ( "time" "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" ) const ( diff --git a/pkg/common/storage/cache/redis/lua_script.go b/pkg/common/storage/cache/redis/lua_script.go index c7609cb443..a2750fda3c 100644 --- a/pkg/common/storage/cache/redis/lua_script.go +++ b/pkg/common/storage/cache/redis/lua_script.go @@ -3,10 +3,13 @@ package redis import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + + "github.com/redis/go-redis/v9" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) var ( diff --git a/pkg/common/storage/cache/redis/lua_script_test.go b/pkg/common/storage/cache/redis/lua_script_test.go index 1566b59a0b..5d3ea9cb15 100644 --- a/pkg/common/storage/cache/redis/lua_script_test.go +++ b/pkg/common/storage/cache/redis/lua_script_test.go @@ -2,10 +2,11 @@ package redis import ( "context" + "testing" + "github.com/go-redis/redismock/v9" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "testing" ) func TestLuaSetBatchWithCommonExpire(t *testing.T) { diff --git a/pkg/common/storage/cache/redis/msg.go b/pkg/common/storage/cache/redis/msg.go index b04bc5c357..eecc775b95 100644 --- a/pkg/common/storage/cache/redis/msg.go +++ b/pkg/common/storage/cache/redis/msg.go @@ -2,15 +2,20 @@ package redis import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "time" + + "github.com/redis/go-redis/v9" + "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" - "time" -) // + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" +) + +// // msgCacheTimeout is expiration time of message cache, 86400 seconds const msgCacheTimeout = 86400 diff --git a/pkg/common/storage/cache/redis/msg_test.go b/pkg/common/storage/cache/redis/msg_test.go index 10b9ce18b0..0911bd3ac9 100644 --- a/pkg/common/storage/cache/redis/msg_test.go +++ b/pkg/common/storage/cache/redis/msg_test.go @@ -16,11 +16,13 @@ package redis import ( "context" "fmt" - "github.com/openimsdk/protocol/sdkws" + "testing" + "github.com/redis/go-redis/v9" "github.com/stretchr/testify/assert" "google.golang.org/protobuf/proto" - "testing" + + "github.com/openimsdk/protocol/sdkws" ) func Test_msgCache_SetMessagesToCache(t *testing.T) { diff --git a/pkg/common/storage/cache/redis/online.go b/pkg/common/storage/cache/redis/online.go index b6c90264e1..e6a144da24 100644 --- a/pkg/common/storage/cache/redis/online.go +++ b/pkg/common/storage/cache/redis/online.go @@ -3,15 +3,18 @@ package redis import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" "strconv" "strings" "time" + + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" ) func NewUserOnline(rdb redis.UniversalClient) cache.OnlineCache { diff --git a/pkg/common/storage/cache/redis/online_test.go b/pkg/common/storage/cache/redis/online_test.go index 0306f6f5d7..a597bd5815 100644 --- a/pkg/common/storage/cache/redis/online_test.go +++ b/pkg/common/storage/cache/redis/online_test.go @@ -2,10 +2,12 @@ package redis import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/tools/db/redisutil" "testing" "time" + + "github.com/openimsdk/tools/db/redisutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) /* diff --git a/pkg/common/storage/cache/redis/redis_shard_manager.go b/pkg/common/storage/cache/redis/redis_shard_manager.go index 17e5fecf6f..394aa16a01 100644 --- a/pkg/common/storage/cache/redis/redis_shard_manager.go +++ b/pkg/common/storage/cache/redis/redis_shard_manager.go @@ -2,11 +2,13 @@ package redis import ( "context" + "github.com/dtm-labs/rockscache" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" "github.com/redis/go-redis/v9" "golang.org/x/sync/errgroup" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" ) const ( diff --git a/pkg/common/storage/cache/redis/s3.go b/pkg/common/storage/cache/redis/s3.go index 954557aca7..da56aa21d5 100644 --- a/pkg/common/storage/cache/redis/s3.go +++ b/pkg/common/storage/cache/redis/s3.go @@ -16,16 +16,19 @@ package redis import ( "context" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/s3" + "github.com/openimsdk/tools/s3/cont" + "github.com/openimsdk/tools/s3/minio" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/s3" - "github.com/openimsdk/tools/s3/cont" - "github.com/openimsdk/tools/s3/minio" - "github.com/redis/go-redis/v9" - "time" ) func NewObjectCacheRedis(rdb redis.UniversalClient, objDB database.ObjectInfo) cache.ObjectCache { diff --git a/pkg/common/storage/cache/redis/seq_conversation.go b/pkg/common/storage/cache/redis/seq_conversation.go index 71705cef7e..c9674b5055 100644 --- a/pkg/common/storage/cache/redis/seq_conversation.go +++ b/pkg/common/storage/cache/redis/seq_conversation.go @@ -4,16 +4,19 @@ import ( "context" "errors" "fmt" + "strconv" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" - "strconv" - "time" ) func NewSeqConversationCacheRedis(rdb redis.UniversalClient, mgo database.SeqConversation) cache.SeqConversationCache { diff --git a/pkg/common/storage/cache/redis/seq_conversation_test.go b/pkg/common/storage/cache/redis/seq_conversation_test.go index d8bfdfbfbf..8acbd110af 100644 --- a/pkg/common/storage/cache/redis/seq_conversation_test.go +++ b/pkg/common/storage/cache/redis/seq_conversation_test.go @@ -2,15 +2,17 @@ package redis import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/redis/go-redis/v9" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" "strconv" "sync" "sync/atomic" "testing" "time" + + "github.com/redis/go-redis/v9" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" ) func newTestSeq() *seqConversationCacheRedis { diff --git a/pkg/common/storage/cache/redis/seq_user.go b/pkg/common/storage/cache/redis/seq_user.go index 0cedfeee12..e1f9d3f267 100644 --- a/pkg/common/storage/cache/redis/seq_user.go +++ b/pkg/common/storage/cache/redis/seq_user.go @@ -2,14 +2,17 @@ package redis import ( "context" + "strconv" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/tools/errs" - "github.com/redis/go-redis/v9" - "strconv" - "time" ) func NewSeqUserCacheRedis(rdb redis.UniversalClient, mgo database.SeqUser) cache.SeqUser { diff --git a/pkg/common/storage/cache/redis/seq_user_test.go b/pkg/common/storage/cache/redis/seq_user_test.go index 0059c81db9..610b41b257 100644 --- a/pkg/common/storage/cache/redis/seq_user_test.go +++ b/pkg/common/storage/cache/redis/seq_user_test.go @@ -3,16 +3,18 @@ package redis import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - mgo2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/redis/go-redis/v9" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" "log" "strconv" "sync/atomic" "testing" "time" + + "github.com/redis/go-redis/v9" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + mgo2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" ) func newTestOnline() *userOnline { diff --git a/pkg/common/storage/cache/redis/third.go b/pkg/common/storage/cache/redis/third.go index 3288cecb8f..09aa0e638f 100644 --- a/pkg/common/storage/cache/redis/third.go +++ b/pkg/common/storage/cache/redis/third.go @@ -16,11 +16,14 @@ package redis import ( "context" + "time" + + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/tools/errs" - "github.com/redis/go-redis/v9" - "time" ) func NewThirdCache(rdb redis.UniversalClient) cache.ThirdCache { diff --git a/pkg/common/storage/cache/redis/token.go b/pkg/common/storage/cache/redis/token.go index 998b4f1c95..37fc01d7ea 100644 --- a/pkg/common/storage/cache/redis/token.go +++ b/pkg/common/storage/cache/redis/token.go @@ -2,13 +2,16 @@ package redis import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/tools/errs" - "github.com/redis/go-redis/v9" "strconv" "sync" "time" + + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" ) type tokenCache struct { diff --git a/pkg/common/storage/cache/redis/user.go b/pkg/common/storage/cache/redis/user.go index f6b4907302..8d4a824386 100644 --- a/pkg/common/storage/cache/redis/user.go +++ b/pkg/common/storage/cache/redis/user.go @@ -16,15 +16,18 @@ package redis import ( "context" + "time" + "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/log" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" - "time" ) const ( diff --git a/pkg/common/storage/cache/s3.go b/pkg/common/storage/cache/s3.go index 4d899586cc..907406f481 100644 --- a/pkg/common/storage/cache/s3.go +++ b/pkg/common/storage/cache/s3.go @@ -16,8 +16,10 @@ package cache import ( "context" - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/s3" + + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type ObjectCache interface { diff --git a/pkg/common/storage/cache/seq_conversation.go b/pkg/common/storage/cache/seq_conversation.go index f35d7bf528..d923be2936 100644 --- a/pkg/common/storage/cache/seq_conversation.go +++ b/pkg/common/storage/cache/seq_conversation.go @@ -2,6 +2,7 @@ package cache import ( "context" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" ) diff --git a/pkg/common/storage/cache/user.go b/pkg/common/storage/cache/user.go index 69a11635ca..96be6e0d72 100644 --- a/pkg/common/storage/cache/user.go +++ b/pkg/common/storage/cache/user.go @@ -16,6 +16,7 @@ package cache import ( "context" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) diff --git a/pkg/common/storage/controller/auth.go b/pkg/common/storage/controller/auth.go index 0a70296627..68f7cb06f6 100644 --- a/pkg/common/storage/controller/auth.go +++ b/pkg/common/storage/controller/auth.go @@ -2,15 +2,18 @@ package controller import ( "context" + "github.com/golang-jwt/jwt/v4" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/tokenverify" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" ) type AuthDatabase interface { diff --git a/pkg/common/storage/controller/black.go b/pkg/common/storage/controller/black.go index 8a12f2aa2d..ed74a7c461 100644 --- a/pkg/common/storage/controller/black.go +++ b/pkg/common/storage/controller/black.go @@ -16,12 +16,14 @@ package controller import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type BlackDatabase interface { diff --git a/pkg/common/storage/controller/conversation.go b/pkg/common/storage/controller/conversation.go index bf41cce957..c776bab95e 100644 --- a/pkg/common/storage/controller/conversation.go +++ b/pkg/common/storage/controller/conversation.go @@ -18,17 +18,17 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/db/tx" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/stringutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" ) type ConversationDatabase interface { diff --git a/pkg/common/storage/controller/friend.go b/pkg/common/storage/controller/friend.go index 88a5fc863d..c4bc77d77b 100644 --- a/pkg/common/storage/controller/friend.go +++ b/pkg/common/storage/controller/friend.go @@ -17,12 +17,8 @@ package controller import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/db/tx" @@ -30,6 +26,11 @@ import ( "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type FriendDatabase interface { diff --git a/pkg/common/storage/controller/group.go b/pkg/common/storage/controller/group.go index 072429ed09..e767b2c64f 100644 --- a/pkg/common/storage/controller/group.go +++ b/pkg/common/storage/controller/group.go @@ -18,19 +18,20 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - redis2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/redis/go-redis/v9" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/db/tx" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + redis2 "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/common" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type GroupDatabase interface { diff --git a/pkg/common/storage/controller/msg.go b/pkg/common/storage/controller/msg.go index 85b797c401..8819c20969 100644 --- a/pkg/common/storage/controller/msg.go +++ b/pkg/common/storage/controller/msg.go @@ -21,12 +21,9 @@ import ( "strings" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/redis/go-redis/v9" + "go.mongodb.org/mongo-driver/mongo" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/protocol/constant" pbmsg "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" @@ -35,8 +32,12 @@ import ( "github.com/openimsdk/tools/mq/kafka" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/timeutil" - "github.com/redis/go-redis/v9" - "go.mongodb.org/mongo-driver/mongo" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) const ( diff --git a/pkg/common/storage/controller/msg_transfer.go b/pkg/common/storage/controller/msg_transfer.go index 1ecd786aa3..73c36387eb 100644 --- a/pkg/common/storage/controller/msg_transfer.go +++ b/pkg/common/storage/controller/msg_transfer.go @@ -2,19 +2,21 @@ package controller import ( "context" + + "go.mongodb.org/mongo-driver/mongo" + "github.com/openimsdk/protocol/constant" + pbmsg "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mq/kafka" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - pbmsg "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/mq/kafka" - "go.mongodb.org/mongo-driver/mongo" ) type MsgTransferDatabase interface { diff --git a/pkg/common/storage/controller/push.go b/pkg/common/storage/controller/push.go index 91ef126fe5..346f70600e 100644 --- a/pkg/common/storage/controller/push.go +++ b/pkg/common/storage/controller/push.go @@ -17,12 +17,13 @@ package controller import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/protocol/push" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mq/kafka" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" ) type PushDatabase interface { diff --git a/pkg/common/storage/controller/s3.go b/pkg/common/storage/controller/s3.go index 4e5ad18b6e..2d3d65b294 100644 --- a/pkg/common/storage/controller/s3.go +++ b/pkg/common/storage/controller/s3.go @@ -19,15 +19,16 @@ import ( "path/filepath" "time" - redisCache "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/redis/go-redis/v9" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/s3" "github.com/openimsdk/tools/s3/cont" - "github.com/redis/go-redis/v9" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + redisCache "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type S3Database interface { diff --git a/pkg/common/storage/controller/stream_msg.go b/pkg/common/storage/controller/stream_msg.go index 3409ccd93c..1155ce5434 100644 --- a/pkg/common/storage/controller/stream_msg.go +++ b/pkg/common/storage/controller/stream_msg.go @@ -2,9 +2,10 @@ package controller import ( "context" + "time" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "time" ) type StreamMsgDatabase interface { diff --git a/pkg/common/storage/controller/third.go b/pkg/common/storage/controller/third.go index a9c2ae403c..f233a64fba 100644 --- a/pkg/common/storage/controller/third.go +++ b/pkg/common/storage/controller/third.go @@ -18,11 +18,11 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" - "github.com/openimsdk/tools/db/pagination" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type ThirdDatabase interface { diff --git a/pkg/common/storage/controller/user.go b/pkg/common/storage/controller/user.go index 3f34481a36..ebbabebd11 100644 --- a/pkg/common/storage/controller/user.go +++ b/pkg/common/storage/controller/user.go @@ -18,16 +18,15 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/db/tx" - "github.com/openimsdk/tools/utils/datautil" - - "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type UserDatabase interface { diff --git a/pkg/common/storage/database/black.go b/pkg/common/storage/database/black.go index b53fdd14dc..bbc0c85c1f 100644 --- a/pkg/common/storage/database/black.go +++ b/pkg/common/storage/database/black.go @@ -16,8 +16,10 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Black interface { diff --git a/pkg/common/storage/database/conversation.go b/pkg/common/storage/database/conversation.go index 30ca01ee71..baf41b59aa 100644 --- a/pkg/common/storage/database/conversation.go +++ b/pkg/common/storage/database/conversation.go @@ -17,8 +17,9 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Conversation interface { diff --git a/pkg/common/storage/database/friend.go b/pkg/common/storage/database/friend.go index b596411fce..3c2f6a95d5 100644 --- a/pkg/common/storage/database/friend.go +++ b/pkg/common/storage/database/friend.go @@ -17,8 +17,9 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) // Friend defines the operations for managing friends in MongoDB. diff --git a/pkg/common/storage/database/friend_request.go b/pkg/common/storage/database/friend_request.go index f163b4831f..a3c45ffd10 100644 --- a/pkg/common/storage/database/friend_request.go +++ b/pkg/common/storage/database/friend_request.go @@ -16,8 +16,10 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type FriendRequest interface { diff --git a/pkg/common/storage/database/group.go b/pkg/common/storage/database/group.go index 7ef22f6c9a..88686efc26 100644 --- a/pkg/common/storage/database/group.go +++ b/pkg/common/storage/database/group.go @@ -16,9 +16,11 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/pagination" "time" + + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Group interface { diff --git a/pkg/common/storage/database/group_member.go b/pkg/common/storage/database/group_member.go index 0ddf0654c0..8bae29359c 100644 --- a/pkg/common/storage/database/group_member.go +++ b/pkg/common/storage/database/group_member.go @@ -17,8 +17,9 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type GroupMember interface { diff --git a/pkg/common/storage/database/group_request.go b/pkg/common/storage/database/group_request.go index 7309584f01..61a4d2a824 100644 --- a/pkg/common/storage/database/group_request.go +++ b/pkg/common/storage/database/group_request.go @@ -16,8 +16,10 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type GroupRequest interface { diff --git a/pkg/common/storage/database/log.go b/pkg/common/storage/database/log.go index 383cc55470..64ce6b6f82 100644 --- a/pkg/common/storage/database/log.go +++ b/pkg/common/storage/database/log.go @@ -16,9 +16,11 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/pagination" "time" + + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Log interface { diff --git a/pkg/common/storage/database/mgo/black.go b/pkg/common/storage/database/mgo/black.go index 4a7a35e6f1..c265c55754 100644 --- a/pkg/common/storage/database/mgo/black.go +++ b/pkg/common/storage/database/mgo/black.go @@ -16,14 +16,16 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewBlackMongo(db *mongo.Database) (database.Black, error) { diff --git a/pkg/common/storage/database/mgo/conversation.go b/pkg/common/storage/database/mgo/conversation.go index 10e223c893..fadbc07ca0 100644 --- a/pkg/common/storage/database/mgo/conversation.go +++ b/pkg/common/storage/database/mgo/conversation.go @@ -18,16 +18,17 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/errs" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewConversationMongo(db *mongo.Database) (*ConversationMgo, error) { diff --git a/pkg/common/storage/database/mgo/friend.go b/pkg/common/storage/database/mgo/friend.go index 76c82bac24..08a1a29836 100644 --- a/pkg/common/storage/database/mgo/friend.go +++ b/pkg/common/storage/database/mgo/friend.go @@ -16,16 +16,18 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "go.mongodb.org/mongo-driver/bson/primitive" "time" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) // FriendMgo implements Friend using MongoDB as the storage backend. diff --git a/pkg/common/storage/database/mgo/friend_request.go b/pkg/common/storage/database/mgo/friend_request.go index 4eed2f4a26..2cad1f9a66 100644 --- a/pkg/common/storage/database/mgo/friend_request.go +++ b/pkg/common/storage/database/mgo/friend_request.go @@ -16,14 +16,16 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewFriendRequestMongo(db *mongo.Database) (database.FriendRequest, error) { diff --git a/pkg/common/storage/database/mgo/group.go b/pkg/common/storage/database/mgo/group.go index 620269b43f..467f9430e5 100644 --- a/pkg/common/storage/database/mgo/group.go +++ b/pkg/common/storage/database/mgo/group.go @@ -16,17 +16,19 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/errs" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewGroupMongo(db *mongo.Database) (database.Group, error) { diff --git a/pkg/common/storage/database/mgo/group_member.go b/pkg/common/storage/database/mgo/group_member.go index 510a049d05..b89d60a85c 100644 --- a/pkg/common/storage/database/mgo/group_member.go +++ b/pkg/common/storage/database/mgo/group_member.go @@ -17,17 +17,18 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/log" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/errs" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewGroupMember(db *mongo.Database) (database.GroupMember, error) { diff --git a/pkg/common/storage/database/mgo/group_request.go b/pkg/common/storage/database/mgo/group_request.go index b1942b7083..54851decec 100644 --- a/pkg/common/storage/database/mgo/group_request.go +++ b/pkg/common/storage/database/mgo/group_request.go @@ -16,15 +16,17 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" - "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewGroupRequestMgo(db *mongo.Database) (database.GroupRequest, error) { diff --git a/pkg/common/storage/database/mgo/helpers.go b/pkg/common/storage/database/mgo/helpers.go index 23e66236ad..5ce143ae6c 100644 --- a/pkg/common/storage/database/mgo/helpers.go +++ b/pkg/common/storage/database/mgo/helpers.go @@ -15,8 +15,9 @@ package mgo import ( - "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/mongo" + + "github.com/openimsdk/tools/errs" ) func IsNotFound(err error) bool { diff --git a/pkg/common/storage/database/mgo/log.go b/pkg/common/storage/database/mgo/log.go index 6ff4c60395..4b395cea15 100644 --- a/pkg/common/storage/database/mgo/log.go +++ b/pkg/common/storage/database/mgo/log.go @@ -16,15 +16,17 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewLogMongo(db *mongo.Database) (database.Log, error) { diff --git a/pkg/common/storage/database/mgo/msg.go b/pkg/common/storage/database/mgo/msg.go index fc1fe47eab..cf152a935b 100644 --- a/pkg/common/storage/database/mgo/msg.go +++ b/pkg/common/storage/database/mgo/msg.go @@ -5,9 +5,10 @@ import ( "fmt" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/utils/datautil" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" "golang.org/x/exp/rand" "github.com/openimsdk/protocol/constant" @@ -16,11 +17,11 @@ import ( "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/jsonutil" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/bson/primitive" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewMsgMongo(db *mongo.Database) (database.Msg, error) { diff --git a/pkg/common/storage/database/mgo/msg_test.go b/pkg/common/storage/database/mgo/msg_test.go index 5aed4dc511..3078714501 100644 --- a/pkg/common/storage/database/mgo/msg_test.go +++ b/pkg/common/storage/database/mgo/msg_test.go @@ -2,17 +2,20 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/db/mongoutil" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" "math/rand" "strconv" "testing" "time" + + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/protocol/msg" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/db/mongoutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func TestName1(t *testing.T) { diff --git a/pkg/common/storage/database/mgo/object.go b/pkg/common/storage/database/mgo/object.go index 5bc329d33b..6413a25e9d 100644 --- a/pkg/common/storage/database/mgo/object.go +++ b/pkg/common/storage/database/mgo/object.go @@ -18,15 +18,16 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/pagination" "github.com/openimsdk/tools/errs" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewS3Mongo(db *mongo.Database) (database.ObjectInfo, error) { diff --git a/pkg/common/storage/database/mgo/seq_conversation.go b/pkg/common/storage/database/mgo/seq_conversation.go index 7971b7e1a7..524a3127c5 100644 --- a/pkg/common/storage/database/mgo/seq_conversation.go +++ b/pkg/common/storage/database/mgo/seq_conversation.go @@ -3,12 +3,15 @@ package mgo import ( "context" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewSeqConversationMongo(db *mongo.Database) (database.SeqConversation, error) { diff --git a/pkg/common/storage/database/mgo/seq_conversation_test.go b/pkg/common/storage/database/mgo/seq_conversation_test.go index 42507a6937..ae889fbba3 100644 --- a/pkg/common/storage/database/mgo/seq_conversation_test.go +++ b/pkg/common/storage/database/mgo/seq_conversation_test.go @@ -2,10 +2,11 @@ package mgo import ( "context" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" "testing" "time" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" ) func Result[V any](val V, err error) V { diff --git a/pkg/common/storage/database/mgo/seq_user.go b/pkg/common/storage/database/mgo/seq_user.go index 244de30000..e17a54383b 100644 --- a/pkg/common/storage/database/mgo/seq_user.go +++ b/pkg/common/storage/database/mgo/seq_user.go @@ -3,12 +3,15 @@ package mgo import ( "context" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewSeqUserMongo(db *mongo.Database) (database.SeqUser, error) { diff --git a/pkg/common/storage/database/mgo/stream_msg.go b/pkg/common/storage/database/mgo/stream_msg.go index c57798daa5..17139639c8 100644 --- a/pkg/common/storage/database/mgo/stream_msg.go +++ b/pkg/common/storage/database/mgo/stream_msg.go @@ -2,14 +2,17 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/errs" + "time" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "time" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewStreamMsgMongo(db *mongo.Database) (*StreamMsgMongo, error) { diff --git a/pkg/common/storage/database/mgo/user.go b/pkg/common/storage/database/mgo/user.go index ee92b75544..5e9c2dd1db 100644 --- a/pkg/common/storage/database/mgo/user.go +++ b/pkg/common/storage/database/mgo/user.go @@ -16,18 +16,20 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" - "github.com/openimsdk/protocol/user" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/pagination" - "github.com/openimsdk/tools/errs" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/pagination" + "github.com/openimsdk/tools/errs" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) func NewUserMongo(db *mongo.Database) (database.User, error) { diff --git a/pkg/common/storage/database/mgo/version_log.go b/pkg/common/storage/database/mgo/version_log.go index 2c4bdef4e8..327deedbe0 100644 --- a/pkg/common/storage/database/mgo/version_log.go +++ b/pkg/common/storage/database/mgo/version_log.go @@ -5,16 +5,18 @@ import ( "errors" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" ) func NewVersionLog(coll *mongo.Collection) (database.VersionLog, error) { diff --git a/pkg/common/storage/database/mgo/version_test.go b/pkg/common/storage/database/mgo/version_test.go index 4576e45bcd..6ca05d0fcc 100644 --- a/pkg/common/storage/database/mgo/version_test.go +++ b/pkg/common/storage/database/mgo/version_test.go @@ -2,11 +2,13 @@ package mgo import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" "testing" "time" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) //func Result[V any](val V, err error) V { diff --git a/pkg/common/storage/database/msg.go b/pkg/common/storage/database/msg.go index 23a99f5b96..9e3be8f4fd 100644 --- a/pkg/common/storage/database/msg.go +++ b/pkg/common/storage/database/msg.go @@ -18,9 +18,11 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" - "github.com/openimsdk/protocol/msg" "go.mongodb.org/mongo-driver/mongo" + + "github.com/openimsdk/protocol/msg" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Msg interface { diff --git a/pkg/common/storage/database/object.go b/pkg/common/storage/database/object.go index c741e39a60..5a9d6a84a2 100644 --- a/pkg/common/storage/database/object.go +++ b/pkg/common/storage/database/object.go @@ -18,8 +18,9 @@ import ( "context" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "github.com/openimsdk/tools/db/pagination" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type ObjectInfo interface { diff --git a/pkg/common/storage/database/stream_msg.go b/pkg/common/storage/database/stream_msg.go index e83fffbaae..021cdbd767 100644 --- a/pkg/common/storage/database/stream_msg.go +++ b/pkg/common/storage/database/stream_msg.go @@ -2,8 +2,9 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "time" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type StreamMsg interface { diff --git a/pkg/common/storage/database/user.go b/pkg/common/storage/database/user.go index 4ddc8285f6..046d53db39 100644 --- a/pkg/common/storage/database/user.go +++ b/pkg/common/storage/database/user.go @@ -16,10 +16,12 @@ package database import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" + "time" + "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/db/pagination" - "time" + + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type User interface { diff --git a/pkg/common/storage/model/application.go b/pkg/common/storage/model/application.go index b09b0e8948..70ff4e5946 100644 --- a/pkg/common/storage/model/application.go +++ b/pkg/common/storage/model/application.go @@ -1,8 +1,9 @@ package model import ( - "go.mongodb.org/mongo-driver/bson/primitive" "time" + + "go.mongodb.org/mongo-driver/bson/primitive" ) type Application struct { diff --git a/pkg/common/storage/model/friend.go b/pkg/common/storage/model/friend.go index abcca2f2b9..996189f6c0 100644 --- a/pkg/common/storage/model/friend.go +++ b/pkg/common/storage/model/friend.go @@ -15,8 +15,9 @@ package model import ( - "go.mongodb.org/mongo-driver/bson/primitive" "time" + + "go.mongodb.org/mongo-driver/bson/primitive" ) // Friend represents the data structure for a friend relationship in MongoDB. diff --git a/pkg/common/storage/model/msg.go b/pkg/common/storage/model/msg.go index e16233973b..0ae907f5ec 100644 --- a/pkg/common/storage/model/msg.go +++ b/pkg/common/storage/model/msg.go @@ -15,9 +15,10 @@ package model import ( + "strconv" + "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" - "strconv" ) const ( diff --git a/pkg/common/storage/model/version_log.go b/pkg/common/storage/model/version_log.go index 6ed8d30f2e..2a9c8ff960 100644 --- a/pkg/common/storage/model/version_log.go +++ b/pkg/common/storage/model/version_log.go @@ -3,9 +3,11 @@ package model import ( "context" "errors" - "github.com/openimsdk/tools/log" - "go.mongodb.org/mongo-driver/bson/primitive" "time" + + "go.mongodb.org/mongo-driver/bson/primitive" + + "github.com/openimsdk/tools/log" ) const ( diff --git a/pkg/common/storage/versionctx/rpc.go b/pkg/common/storage/versionctx/rpc.go index 67b95aebd5..43b4ab92bf 100644 --- a/pkg/common/storage/versionctx/rpc.go +++ b/pkg/common/storage/versionctx/rpc.go @@ -2,6 +2,7 @@ package versionctx import ( "context" + "google.golang.org/grpc" ) diff --git a/pkg/common/storage/versionctx/version.go b/pkg/common/storage/versionctx/version.go index 5db8856401..e0c9d85984 100644 --- a/pkg/common/storage/versionctx/version.go +++ b/pkg/common/storage/versionctx/version.go @@ -2,8 +2,9 @@ package versionctx import ( "context" - tablerelation "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" "sync" + + tablerelation "github.com/openimsdk/open-im-server/v3/pkg/common/storage/model" ) type Collection struct { diff --git a/pkg/common/webhook/condition.go b/pkg/common/webhook/condition.go index 2c038f5674..2cb9a4f550 100644 --- a/pkg/common/webhook/condition.go +++ b/pkg/common/webhook/condition.go @@ -2,6 +2,7 @@ package webhook import ( "context" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) diff --git a/pkg/common/webhook/http_client.go b/pkg/common/webhook/http_client.go index e46f08806d..c0c5a8fc0b 100644 --- a/pkg/common/webhook/http_client.go +++ b/pkg/common/webhook/http_client.go @@ -17,15 +17,17 @@ package webhook import ( "context" "encoding/json" - "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "net/http" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/mcontext" "github.com/openimsdk/tools/mq/memamq" "github.com/openimsdk/tools/utils/httputil" - "net/http" + + "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) type Client struct { diff --git a/pkg/localcache/init.go b/pkg/localcache/init.go index d1c16f6751..d0bccaa7e5 100644 --- a/pkg/localcache/init.go +++ b/pkg/localcache/init.go @@ -15,10 +15,11 @@ package localcache import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "strings" "sync" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" ) var ( diff --git a/pkg/msgprocessor/conversation.go b/pkg/msgprocessor/conversation.go index 04d772d161..3bfcd80f69 100644 --- a/pkg/msgprocessor/conversation.go +++ b/pkg/msgprocessor/conversation.go @@ -18,10 +18,11 @@ import ( "sort" "strings" + "google.golang.org/protobuf/proto" + "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/errs" - "google.golang.org/protobuf/proto" ) func IsGroupConversationID(conversationID string) bool { diff --git a/pkg/rpccache/common.go b/pkg/rpccache/common.go index 15b3a8e094..0bc5744e3c 100644 --- a/pkg/rpccache/common.go +++ b/pkg/rpccache/common.go @@ -15,8 +15,9 @@ package rpccache import ( - "github.com/openimsdk/tools/errs" "google.golang.org/protobuf/proto" + + "github.com/openimsdk/tools/errs" ) func newListMap[V comparable](values []V, err error) (*listMap[V], error) { diff --git a/pkg/rpccache/conversation.go b/pkg/rpccache/conversation.go index 925d2a37ca..c4e849f27c 100644 --- a/pkg/rpccache/conversation.go +++ b/pkg/rpccache/conversation.go @@ -16,16 +16,19 @@ package rpccache import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + + "github.com/redis/go-redis/v9" + "golang.org/x/sync/errgroup" + pbconversation "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" - "github.com/redis/go-redis/v9" - "golang.org/x/sync/errgroup" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) const ( diff --git a/pkg/rpccache/friend.go b/pkg/rpccache/friend.go index dca3b4c97c..b2979ec3db 100644 --- a/pkg/rpccache/friend.go +++ b/pkg/rpccache/friend.go @@ -16,14 +16,16 @@ package rpccache import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + + "github.com/redis/go-redis/v9" + "github.com/openimsdk/protocol/relation" + "github.com/openimsdk/tools/log" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/localcache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" ) func NewFriendLocalCache(client rpcclient.FriendRpcClient, localCache *config.LocalCache, cli redis.UniversalClient) *FriendLocalCache { diff --git a/pkg/rpccache/group.go b/pkg/rpccache/group.go index b2d852fc5f..50e6ea58d2 100644 --- a/pkg/rpccache/group.go +++ b/pkg/rpccache/group.go @@ -16,17 +16,19 @@ package rpccache import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + + "github.com/redis/go-redis/v9" + "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/sdkws" + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/localcache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - "github.com/openimsdk/protocol/sdkws" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" ) func NewGroupLocalCache(client rpcclient.GroupRpcClient, localCache *config.LocalCache, cli redis.UniversalClient) *GroupLocalCache { diff --git a/pkg/rpccache/online.go b/pkg/rpccache/online.go index a02a0662d4..e1d623b8b6 100644 --- a/pkg/rpccache/online.go +++ b/pkg/rpccache/online.go @@ -3,23 +3,25 @@ package rpccache import ( "context" "fmt" - "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/user" "math/rand" "strconv" "sync" "sync/atomic" "time" + "github.com/redis/go-redis/v9" + + "github.com/openimsdk/protocol/constant" + "github.com/openimsdk/protocol/user" + "github.com/openimsdk/tools/db/cacheutil" + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mcontext" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" "github.com/openimsdk/open-im-server/v3/pkg/localcache" "github.com/openimsdk/open-im-server/v3/pkg/localcache/lru" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/open-im-server/v3/pkg/util/useronline" - "github.com/openimsdk/tools/db/cacheutil" - "github.com/openimsdk/tools/log" - "github.com/openimsdk/tools/mcontext" - "github.com/redis/go-redis/v9" ) func NewOnlineCache(user rpcclient.UserRpcClient, group *GroupLocalCache, rdb redis.UniversalClient, fullUserCache bool, fn func(ctx context.Context, userID string, platformIDs []int32)) (*OnlineCache, error) { diff --git a/pkg/rpccache/subscriber.go b/pkg/rpccache/subscriber.go index 3c73ef4496..121bf068e4 100644 --- a/pkg/rpccache/subscriber.go +++ b/pkg/rpccache/subscriber.go @@ -17,10 +17,11 @@ package rpccache import ( "context" "encoding/json" - "github.com/openimsdk/tools/mw" - "github.com/openimsdk/tools/log" "github.com/redis/go-redis/v9" + + "github.com/openimsdk/tools/log" + "github.com/openimsdk/tools/mw" ) func subscriberRedisDeleteCache(ctx context.Context, client redis.UniversalClient, channel string, del func(ctx context.Context, key ...string)) { diff --git a/pkg/rpccache/user.go b/pkg/rpccache/user.go index 79a768597f..40556d5f05 100644 --- a/pkg/rpccache/user.go +++ b/pkg/rpccache/user.go @@ -17,15 +17,17 @@ package rpccache import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/localcache" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" + "github.com/redis/go-redis/v9" + "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" - "github.com/redis/go-redis/v9" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/localcache" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" ) func NewUserLocalCache(client rpcclient.UserRpcClient, localCache *config.LocalCache, cli redis.UniversalClient) *UserLocalCache { diff --git a/pkg/rpcclient/auth.go b/pkg/rpcclient/auth.go index 05fec35a08..18bea0aaa0 100644 --- a/pkg/rpcclient/auth.go +++ b/pkg/rpcclient/auth.go @@ -17,10 +17,11 @@ package rpcclient import ( "context" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/auth" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" ) func NewAuth(discov discovery.SvcDiscoveryRegistry, rpcRegisterName string) *Auth { diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index c69d355d68..f379308514 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -18,11 +18,12 @@ import ( "context" "fmt" + "google.golang.org/grpc" + pbconversation "github.com/openimsdk/protocol/conversation" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" ) type Conversation struct { diff --git a/pkg/rpcclient/friend.go b/pkg/rpcclient/friend.go index 359ed3a8b8..edd6f50ffa 100644 --- a/pkg/rpcclient/friend.go +++ b/pkg/rpcclient/friend.go @@ -17,11 +17,12 @@ package rpcclient import ( "context" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/relation" sdkws "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" ) type Friend struct { diff --git a/pkg/rpcclient/group.go b/pkg/rpcclient/group.go index 30d0b3288f..36478e595d 100644 --- a/pkg/rpcclient/group.go +++ b/pkg/rpcclient/group.go @@ -18,13 +18,14 @@ import ( "context" "strings" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/group" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" "github.com/openimsdk/tools/utils/datautil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) type Group struct { diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index 8313937cdb..729cfede0e 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -22,7 +22,6 @@ import ( "google.golang.org/grpc" "google.golang.org/protobuf/proto" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/protocol/sdkws" @@ -33,6 +32,8 @@ import ( "github.com/openimsdk/tools/utils/idutil" "github.com/openimsdk/tools/utils/jsonutil" "github.com/openimsdk/tools/utils/timeutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) func newContentTypeConf(conf *config.Notification) map[int32]config.NotificationConfig { diff --git a/pkg/rpcclient/push.go b/pkg/rpcclient/push.go index c549e454a7..650ed27f8d 100644 --- a/pkg/rpcclient/push.go +++ b/pkg/rpcclient/push.go @@ -17,10 +17,11 @@ package rpcclient import ( "context" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/push" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" ) type Push struct { diff --git a/pkg/rpcclient/third.go b/pkg/rpcclient/third.go index 7cdc60d52f..f8a51803df 100644 --- a/pkg/rpcclient/third.go +++ b/pkg/rpcclient/third.go @@ -17,10 +17,11 @@ package rpcclient import ( "context" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/third" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" - "google.golang.org/grpc" ) type Third struct { diff --git a/pkg/rpcclient/user.go b/pkg/rpcclient/user.go index bdc1a2e012..36aa9a7fbc 100644 --- a/pkg/rpcclient/user.go +++ b/pkg/rpcclient/user.go @@ -18,14 +18,16 @@ import ( "context" "strings" - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" + "google.golang.org/grpc" + "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/protocol/user" "github.com/openimsdk/tools/discovery" "github.com/openimsdk/tools/system/program" "github.com/openimsdk/tools/utils/datautil" - "google.golang.org/grpc" + + "github.com/openimsdk/open-im-server/v3/pkg/authverify" + "github.com/openimsdk/open-im-server/v3/pkg/common/servererrs" ) // User represents a structure holding connection details for the User RPC client. diff --git a/pkg/tools/batcher/batcher.go b/pkg/tools/batcher/batcher.go index 163aeed399..b618abf276 100644 --- a/pkg/tools/batcher/batcher.go +++ b/pkg/tools/batcher/batcher.go @@ -3,11 +3,12 @@ package batcher import ( "context" "fmt" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/tools/utils/idutil" "strings" "sync" "time" + + "github.com/openimsdk/tools/errs" + "github.com/openimsdk/tools/utils/idutil" ) var ( diff --git a/pkg/tools/batcher/batcher_test.go b/pkg/tools/batcher/batcher_test.go index 90e0284490..2ced89e741 100644 --- a/pkg/tools/batcher/batcher_test.go +++ b/pkg/tools/batcher/batcher_test.go @@ -3,9 +3,10 @@ package batcher import ( "context" "fmt" - "github.com/openimsdk/tools/utils/stringutil" "testing" "time" + + "github.com/openimsdk/tools/utils/stringutil" ) func TestBatcher(t *testing.T) { diff --git a/tools/check-component/main.go b/tools/check-component/main.go index 94dbd613c4..cd492793e5 100644 --- a/tools/check-component/main.go +++ b/tools/check-component/main.go @@ -24,8 +24,6 @@ import ( "path/filepath" "time" - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/discovery/etcd" @@ -33,6 +31,9 @@ import ( "github.com/openimsdk/tools/mq/kafka" "github.com/openimsdk/tools/s3/minio" "github.com/openimsdk/tools/system/program" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) const maxRetry = 180 diff --git a/tools/seq/internal/main.go b/tools/seq/internal/main.go index 2bec5a8f1c..ce076ecf15 100644 --- a/tools/seq/internal/main.go +++ b/tools/seq/internal/main.go @@ -5,16 +5,6 @@ import ( "context" "errors" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" - "github.com/openimsdk/tools/db/mongoutil" - "github.com/openimsdk/tools/db/redisutil" - "github.com/redis/go-redis/v9" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" - "gopkg.in/yaml.v3" "os" "os/signal" "path/filepath" @@ -24,6 +14,19 @@ import ( "sync/atomic" "syscall" "time" + + "github.com/redis/go-redis/v9" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "gopkg.in/yaml.v3" + + "github.com/openimsdk/tools/db/mongoutil" + "github.com/openimsdk/tools/db/redisutil" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cmd" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" ) const ( diff --git a/tools/seq/main.go b/tools/seq/main.go index 16da9f156e..11fa6cfa65 100644 --- a/tools/seq/main.go +++ b/tools/seq/main.go @@ -3,8 +3,9 @@ package main import ( "flag" "fmt" - "github.com/openimsdk/open-im-server/v3/tools/seq/internal" "time" + + "github.com/openimsdk/open-im-server/v3/tools/seq/internal" ) func main() { diff --git a/tools/streammsg/main.go b/tools/streammsg/main.go index bb567e2332..cbf22325db 100644 --- a/tools/streammsg/main.go +++ b/tools/streammsg/main.go @@ -5,19 +5,22 @@ import ( "context" "encoding/json" "fmt" + "io" + "net/http" + "strings" + "time" + "github.com/gin-gonic/gin" "github.com/google/uuid" - "github.com/openimsdk/open-im-server/v3/pkg/apistruct" - cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" + "github.com/openimsdk/protocol/auth" "github.com/openimsdk/protocol/constant" "github.com/openimsdk/protocol/msg" "github.com/openimsdk/tools/apiresp" "github.com/openimsdk/tools/errs" - "io" - "net/http" - "strings" - "time" + + "github.com/openimsdk/open-im-server/v3/pkg/apistruct" + cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" ) const ( diff --git a/tools/url2im/pkg/manage.go b/tools/url2im/pkg/manage.go index 9dc1de8010..9ce95cb254 100644 --- a/tools/url2im/pkg/manage.go +++ b/tools/url2im/pkg/manage.go @@ -33,9 +33,8 @@ import ( "sync/atomic" "time" - "github.com/openimsdk/tools/errs" - "github.com/openimsdk/protocol/third" + "github.com/openimsdk/tools/errs" ) type Upload struct { diff --git a/tools/versionchecker/main.go b/tools/versionchecker/main.go index bec7daa799..9b858a26be 100644 --- a/tools/versionchecker/main.go +++ b/tools/versionchecker/main.go @@ -21,6 +21,7 @@ import ( "runtime" "github.com/fatih/color" + "github.com/openimsdk/tools/utils/timeutil" )