typeorm-cursor-pagination
Version:
Cursor-based pagination works with TypeORM.
16 lines (15 loc) • 509 B
TypeScript
import { ObjectType } from 'typeorm';
import Paginator, { Order } from './Paginator';
export interface PagingQuery {
afterCursor?: string;
beforeCursor?: string;
limit?: number;
order?: Order | 'ASC' | 'DESC';
}
export interface PaginationOptions<Entity> {
entity: ObjectType<Entity>;
alias?: string;
query?: PagingQuery;
paginationKeys?: Extract<keyof Entity, string>[];
}
export declare function buildPaginator<Entity>(options: PaginationOptions<Entity>): Paginator<Entity>;