mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 01:25:58 +08:00
Test_BatchInsertChat2DB
This commit is contained in:
@@ -188,6 +188,10 @@ func (db *commonMsgDatabase) BatchInsertChat2DB(ctx context.Context, conversatio
|
||||
DocID: docID,
|
||||
Msg: make([]unRelationTb.MsgInfoModel, num),
|
||||
}
|
||||
for i := 0; i < len(doc.Msg); i++ {
|
||||
doc.Msg[i].ReadList = []string{}
|
||||
doc.Msg[i].DelList = []string{}
|
||||
}
|
||||
for _, msg := range *msgs {
|
||||
data, err := proto.Marshal(msg)
|
||||
if err != nil {
|
||||
@@ -196,6 +200,8 @@ func (db *commonMsgDatabase) BatchInsertChat2DB(ctx context.Context, conversatio
|
||||
doc.Msg[msg.Seq%num] = unRelationTb.MsgInfoModel{
|
||||
SendTime: msg.SendTime,
|
||||
Msg: data,
|
||||
ReadList: []string{},
|
||||
DelList: []string{},
|
||||
}
|
||||
}
|
||||
if err := db.msgDocDatabase.Create(ctx, &doc); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user