FindByCursorOptions<T, U, W>
Defined in: packages/rxdb/src/repository/query-options.interface.ts:116
FindByCursor 查询选项
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends EntityType | EntityType |
U | RuleGroup<InstanceType<T>> |
W extends string | string |
Properties
after?
optional after?: InstanceType<T>;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:144
获取这个实体之后的实体
before?
optional before?: InstanceType<T>;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:139
获取这个实体之前的实体
limit?
optional limit?: number;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:168
获取数据量
Remarks
只约束首次结果(≤ limit)。之后这一页是活查询,条数和边界行会随变更变化,看走哪条合并路径:
- CREATE 的 JS 增量合并(常规路径):原有的行一条不裁。页已满时,落进窗口的新行让页涨过 limit、边界行不动,落在边界行之外的新行属于相邻页、照常裁掉;页未满时新行先补到 limit, 边界行可能外移。
- 回 SQL 重查(UPDATE 命中页内行、让某行新满足 where 或改了排序键;CREATE / DELETE 命中关系 where;CREATE 事件比实体缓存陈旧):整页按 limit 重裁,只靠增量涨出来的行随之裁掉、离开的行 由后面的补上,边界行内移外移都有可能。
- DELETE 的 JS 过滤(常规路径):被删的行直接滤掉、不补位,页可以短于 limit—— 「条数 < limit」推不出「后面没有数据」。
相邻页不受牵连:每页的游标条件在调用时就按 after / before 实体的值固化,本页涨也好缩也好,
下一页的起点都不动。反过来,链式分页的消费者必须在本页边界行(after 链是页尾、before
链是页首)换成另一行时,用新的边界行重开相邻页,否则新旧边界之间的行会漏掉或重复。
三端的 useInfiniteScroll / InfiniteScrollingList 都按此重锚。
Default
100
orderBy
orderBy: OrderBy<W>[];
Defined in: packages/rxdb/src/repository/query-options.interface.ts:134
排序条件 指针查询的时候必须包含唯一值的排序例如: id 作为最后一个排序参数,不然无法定位指针
Example
orderBy: [
{ field: 'createdAt', sort: 'DESC' },
{ field: 'id', sort: 'ASC' } // 必须包含唯一值排序
]
where
where: U;
Defined in: packages/rxdb/src/repository/query-options.interface.ts:121