RongIMLib View Markdown
    Preparing search index...

    Function deleteMessagesByTimestamp

    • 通过时间戳删除指定会话本地消息

      Parameters

      • conversation: IConversationIdentifier

        会话信息

      • timestamp: number

        指定删除该时间戳之前的消息

      • cleanSpace: boolean

        指定删除该时间戳之前的消息。是否清理数据条目所使用的磁盘空间。清理磁盘空间会阻塞进程且耗时较长,不推荐使用。 数据在被抹除的情况下,未清理的磁盘空间会在后续存储操作中复用,且对数据查询无影响

      Returns Promise<RCResult<void>>

      本接口仅适用 Electron 平台,根据时间戳,从本地消息数据库中删除单个会话中早于该时间戳的消息数据。

      5.4.0

      通过时间戳删除示例:

      const conversation = {
      conversationType: RongIMLib.ConversationType.PRIVATE,
      targetId: 'targetId',
      };
      const timestamp = Date.now();
      const cleanSpace = false;
      const res = await RongIMLib.electronExtension.deleteMessagesByTimestamp(conversation, timestamp, cleanSpace);
      console.info('通过时间戳删除结果:', res);