1.0.0 • Published 2 years ago

knex-pages v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

knex-pages

Easily implement pagination into your application.

Usage

const knex = require('knex');
const pages = require('knex-pages');

// (optional) Case style parameter accepts: 'camelCase', 'PascalCase', 'snake_case', 'CAPITALIZED_SNAKE_CASE', 'kebap-case' and 'CAPITALIZED-KEBAB-CASE'
pages();

// Passed configuration passed is optional, defaults to { perPage: 10, currentPage: 1, dataKey: "data" }
const users = await knex('users').paginate({
	perPage: 10,
	currentPage: 2
});