FindOptions<T, U, W>
Defined in: packages/rxdb/src/repository/query-options.interface.ts:47
Find 查询选项
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends EntityType | EntityType |
U | RuleGroup<InstanceType<T>> |
W extends string | string |
Properties
groupBy?
optional groupBy?: string[];
Defined in: packages/rxdb/src/repository/query-options.interface.ts:58
分组字段列表(对应 SQL GROUP BY) 数组元素为列名字符串,由适配器负责标识符转义
limit?
optional limit?: number;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:69
获取数据量
Default
100
localCacheFirst?
optional localCacheFirst?: boolean;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:85
本地缓存优先(stale-while-revalidate)
Remarks
仅对 sync.type === SyncType.QueryCache 的实体有效,其余同步策略忽略本字段。
优先级:调用 > 配置(sync.local.localCacheFirst)> false。
该值参与查询任务的缓存键,同一 where 的两种模式互不复用。
offlineFallback?
optional offlineFallback?: boolean;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:97
离线降级
Remarks
仅对 sync.type === SyncType.QueryCache 的实体有效,其余同步策略忽略本字段。
打开后只有网络故障(连不上远端)会降级成本地缓存,判据见 isNetworkError;
远端给出的非 2xx 是「远端的回答」,照常上抛。本地也没有缓存时抛
NetworkOfflineError,而不是静默返回空集。
该值参与查询任务的缓存键,同一 where 的两种模式互不复用。
offset?
optional offset?: number;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:75
分页偏离量
Default
0
onSyncStats?
optional onSyncStats?: (stats) => void;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:110
QueryCache 增量同步完成后的统计回调
Parameters
| Parameter | Type |
|---|---|
stats | SyncStats |
Returns
void
Remarks
仅对 sync.type === SyncType.QueryCache 的实体有效。
同步范围是整个 where,与 limit 无关,用 remoteCount / pulledCount
观测拉取放大。
函数没有可靠的值身份,因此不进查询任务的缓存键:同一 where 的并发查询
会复用同一个任务,此时只有先到的那次调用的回调会被触发。
orderBy?
optional orderBy?: OrderBy<W>[];
Defined in: packages/rxdb/src/repository/query-options.interface.ts:53
projection?
optional projection?: string[];
Defined in: packages/rxdb/src/repository/query-options.interface.ts:63
投影字段列表(对应 SQL 列选择) 指定需要返回的列名,缺省返回所有列(SELECT *)
where
where: U;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:52