msgDestruct

This commit is contained in:
wangchuxiao
2023-07-10 10:09:51 +08:00
parent c64657d0b7
commit 7bf9d5a305
19 changed files with 508 additions and 344 deletions
+5 -5
View File
@@ -154,27 +154,27 @@ type NotificationSender struct {
getUserInfo func(ctx context.Context, userID string) (*sdkws.UserInfo, error)
}
type NewNotificationSenderOptions func(*NotificationSender)
type NotificationSenderOptions func(*NotificationSender)
func WithLocalSendMsg(sendMsg func(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error)) NewNotificationSenderOptions {
func WithLocalSendMsg(sendMsg func(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error)) NotificationSenderOptions {
return func(s *NotificationSender) {
s.sendMsg = sendMsg
}
}
func WithRpcClient(msgRpcClient *MessageRpcClient) NewNotificationSenderOptions {
func WithRpcClient(msgRpcClient *MessageRpcClient) NotificationSenderOptions {
return func(s *NotificationSender) {
s.sendMsg = msgRpcClient.SendMsg
}
}
func WithUserRpcClient(userRpcClient *UserRpcClient) NewNotificationSenderOptions {
func WithUserRpcClient(userRpcClient *UserRpcClient) NotificationSenderOptions {
return func(s *NotificationSender) {
s.getUserInfo = userRpcClient.GetUserInfo
}
}
func NewNotificationSender(opts ...NewNotificationSenderOptions) *NotificationSender {
func NewNotificationSender(opts ...NotificationSenderOptions) *NotificationSender {
notificationSender := &NotificationSender{contentTypeConf: newContentTypeConf(), sessionTypeConf: newSessionTypeConf()}
for _, opt := range opts {
opt(notificationSender)