From 8aa870ce3fbfd87c62918bd895bd09c52aba3df5 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:59:09 +0000 Subject: [PATCH] Completed the implementation of the SearchMsg function --- internal/rpc/msg/search.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/rpc/msg/search.go b/internal/rpc/msg/search.go index 7e0245954..8c9c1d153 100644 --- a/internal/rpc/msg/search.go +++ b/internal/rpc/msg/search.go @@ -23,7 +23,23 @@ func (s *msgServer) SearchMsg(ctx context.Context, req *pb.SearchMsgReq) (*pb.Se return &pb.SearchMsgResp{}, nil } - // Rest of the function implementation - // ... + // Initialize a slice of pb.ChatLog objects + var pbChatLogs []*pb.ChatLog + + // Iterate over the chatLogs slice + for _, chatLog := range chatLogs { + // Create a pb.ChatLog object for each chatLog and append it to the pbChatLogs slice + pbChatLog := &pb.ChatLog{ + SenderID: chatLog.SenderID, + ReceiverID: chatLog.ReceiverID, + Content: chatLog.Content, + ContentType: chatLog.ContentType, + Timestamp: chatLog.Timestamp, + } + pbChatLogs = append(pbChatLogs, pbChatLog) + } + + // Return the pbChatLogs slice in the pb.SearchMsgResp object + return &pb.SearchMsgResp{ChatLogs: pbChatLogs}, nil }