合并到远程

This commit is contained in:
UnCLAS-Prommer
2026-02-13 13:41:58 +08:00
parent 60f76e4d4e
commit b9f3c17e14
15 changed files with 420 additions and 450 deletions

View File

@@ -0,0 +1,15 @@
import msgpack
from src.common.data_models.message_component_model import MessageSequence
class MessageUtils:
@staticmethod
def from_db_record_msg_to_MaiSeq(raw_content: bytes) -> MessageSequence:
unpacked_data = msgpack.unpackb(raw_content)
return MessageSequence.from_dict(unpacked_data)
@staticmethod
async def from_MaiSeq_to_db_record_msg(msg: MessageSequence) -> bytes:
dict_representation = msg.to_dict()
return msgpack.packb(dict_representation) # type: ignore