跳到主要内容

FetchMetadataResult

type FetchMetadataResult =
| QueryCacheEntityMetadata[]
| {
nextPageToken?: string;
rows: QueryCacheEntityMetadata[];
};

Defined in: packages/rxdb-adapter-http/src/http.interface.ts:90

单页解析结果,两种形态判别式返回。

Union Members​

QueryCacheEntityMetadata[]

形态 1(offset):短页终止(rows.length < limit 即末页)


Type Literal​

{
nextPageToken?: string;
rows: QueryCacheEntityMetadata[];
}

形态 2(token):token 终止(nextPageToken === undefined 即末页)

Remarks​

适配器按首页的返回形状锁定本次查询的翻页模式,中途换形态即抛错 (HttpPaginationError,reason: 'shape_switch')——混用会让两条终止判据互相盖掉, 正是本包要防的静默截断。

对象形态的键叫 nextPageToken。返回改名前的 nextCursor 会被当场判为契约错误 (HttpHandlerContractError)而不是读成 undefined:后者等于首页即末页, 整表只剩第一页而全程不报错。