parent
3a9ca98260
commit
05e8edac43
@ -0,0 +1,31 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/internal/logic/model"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SearchMsgFromDB(ctx context.Context, req *pb.SearchMsgReq) ([]*model.ChatLog, error) {
|
||||||
|
// Construct the database query using the req parameter
|
||||||
|
query := constructQuery(req)
|
||||||
|
|
||||||
|
// Execute the database query
|
||||||
|
chatLogs, err := executeQuery(query)
|
||||||
|
if err != nil {
|
||||||
|
// If the database query fails, return a nil slice and the error
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the database query is successful, return the retrieved chatLogs and a nil error
|
||||||
|
return chatLogs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func constructQuery(req *pb.SearchMsgReq) string {
|
||||||
|
// TODO: Implement the function to construct the database query using the req parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
func executeQuery(query string) ([]*model.ChatLog, error) {
|
||||||
|
// TODO: Implement the function to execute the database query and return the retrieved chatLogs and any error that may occur
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue