同步dbretry接口

This commit is contained in:
Happi (哈比)
2026-03-10 12:49:49 +08:00
parent 1c996075e3
commit 5eaff7ede3
3 changed files with 89 additions and 0 deletions

View File

@@ -14,12 +14,22 @@ abstract class ApiRetryRepository {
Future<ApiRetry?> getById(int id);
/// 读取指定 uid 的第一条重试任务
Future<ApiRetry?> getByUid(int uid);
/// 读取未同步的重试任务
Future<List<ApiRetry>> getPending();
/// 读取未过期的重试任务
Future<List<ApiRetry>> getActive();
/// 读取指定 endPoint 且未同步的重试任务,按 createTime 升序
Future<List<ApiRetry>> getByEndPointPending(String endPoint);
/// 读取指定同步状态的所有重试任务,按 createTime 升序
/// synced: 0 未同步 / 1 已同步 / -1 失败
Future<List<ApiRetry>> getBySynced(int synced);
// ── 写入 ─────────────────────────────────────────────────────────────────
/// 插入重试任务autoIncrement id无需提供
@@ -41,6 +51,9 @@ abstract class ApiRetryRepository {
Future<void> deleteByUid(int uid);
/// 删除已完成的重试任务synced = success / failed / cancel / replace
Future<void> deleteFinished();
/// 清除已同步的重试任务
Future<void> deleteSynced();