Skip to content

v3.5.0

Compare
Choose a tag to compare
@Kaltsoon Kaltsoon released this 15 Feb 11:17
· 12 commits to master since this release

Support "lazy evaluation" version of the paginate function, which can be created using the makePaginateLazy function:

import { makePaginateLazy } from 'sequelize-cursor-pagination';

Counter.paginateLazy = makePaginateLazy(Counter);

// Same options are supported as with the regular paginate function
const connection = Counter.paginateLazy({
  limit: 10,
});

// Only one database query is performed in case we are only insterested in the edges
const edges = await connection.getEdges();

// Otherwise, we can fetch the total count and page info as well
const totalCount = await connection.getTotalCount(); 
const pageInfo = await connection.getPageInfo();