连接
包装一个集合获取,以提供用于处理 GraphQL 游标连接的实用程序。它只需要一个参数,该参数是一个表示记录集合的步骤;此步骤应支持连接方法,特别是
/**
* Clone the plan; it's recommended that you add `$connection` as a
* dependency so that you can abort execution early in the case of errors
* (e.g. if the cursors cannot be parsed).
*/
connectionClone(
$connection: ConnectionStep<TItemStep, TCursorStep, any, any>,
...args: any[]
): ConnectionCapableStep<TItemStep, TCursorStep>;
pageInfo(
$connection: ConnectionStep<
TItemStep,
TCursorStep,
ConnectionCapableStep<TItemStep, TCursorStep>,
any
>,
): PageInfoCapableStep;
setFirst($step: InputStep): void;
setLast($step: InputStep): void;
setOffset($step: InputStep): void;
parseCursor($step: InputStep): TCursorStep | null | undefined;
setBefore($step: TCursorStep): void;
setAfter($step: TCursorStep): void;
待办事项:此文档很糟糕。抱歉。
export function connection<
TItemStep extends ExecutableStep,
TCursorStep extends ExecutableStep,
TStep extends ConnectionCapableStep<TItemStep, TCursorStep>,
TNodeStep extends ExecutableStep = ExecutableStep,
>(
$collection: TStep,
itemPlan?: ($item: TItemStep) => TNodeStep,
cursorPlan?: ($item: TItemStep) => ExecutableStep<string | null>,
): ConnectionStep<TItemStep, TCursorStep, TStep, TNodeStep>;