# sequelize-paginate-cursor

> Paginate with cursor for Sequelize

Latest version **0.0.5** (published 2016-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install sequelize-paginate-cursor
pnpm add sequelize-paginate-cursor
yarn add sequelize-paginate-cursor
bun add sequelize-paginate-cursor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2016-10-20 |
| First published | 2016-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+11 in 2 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | Jinme Mirabal |
| Maintainers | mirabalj |

## Links

- npm: https://www.npmjs.com/package/sequelize-paginate-cursor
- Repository: https://github.com/mirabalj/sequelize-paginate-cursor
- Homepage: https://github.com/mirabalj/sequelize-paginate-cursor#readme
- Issues: https://github.com/mirabalj/sequelize-paginate-cursor/issues
- npm.io page: https://npm.io/package/sequelize-paginate-cursor

## Dependencies (8)

- [mysql](https://npm.io/package/mysql.md) 2.11.1
- [dotenv](https://npm.io/package/dotenv.md) 2.0.0
- [rimraf](https://npm.io/package/rimraf.md) 2.5.4
- [babel-cli](https://npm.io/package/babel-cli.md) 6.14.0
- [sequelize](https://npm.io/package/sequelize.md) 3.24.3
- [babel-core](https://npm.io/package/babel-core.md) 6.8.0
- [babel-preset-stage-3](https://npm.io/package/babel-preset-stage-3.md) 6.5.0
- [babel-preset-es2015-node5](https://npm.io/package/babel-preset-es2015-node5.md) 1.2.0

## Recent versions

- 0.0.5 (latest) — 2016-10-20
- 0.0.4 — 2016-10-18
- 0.0.3 — 2016-10-12
- 0.0.2 — 2016-10-12
- 0.0.1 — 2016-10-12

## README

# sequelize-paginate-cursor 
[![npm](https://img.shields.io/npm/dm/sequelize-paginate-cursor.svg?maxAge=2592000)](https://www.npmjs.com/package/sequelize-paginate-cursor)
[![License](https://img.shields.io/npm/l/sequelize-paginate-cursor.svg?maxAge=2592000?style=plastic)](https://github.com/mirabalj/sequelize-paginate-cursor/blob/master/license)

## Installation

`npm install sequelize-paginate-cursor`

## Usage
```js
var Sequelize = require('sequelize');
var sequelizePagination = require('sequelize-paginate-cursor');

var Model = sequelize.define('user', {
  name: {
    type: Sequelize.STRING,
    field: 'first_name',
  },
}, {
  timestamps: false, // Not timestamps
  freezeTableName: true, // Model tableName will be the same as the model name
});
sequelizePagination(Model, { name: 'paged' }); // custom name, default 'paginate'

var paged = await Model.paginate({
  sinceId, // from what value to get documents (default: null)
  maxId, // to what value to get documents (default: null)
  limit, //amount of documents to get on search (default: 1)
  select, //what values get on request
  where, // query to match the search
  include, // property to establish relationships
  subQuery, // set top level options (default: true)
  keyPaginated, //key to paginate on document (ejm: 'count' ) (default: 'id')
  reverse, //tell the pagination to reverse the search
});

paged.objects // objects found
paged.nextCursor // the key value of the next cursor
```
`.paginate()` returns a promise, or can be used with a callback
`.paginate({},callback)`

## Features to have
- [ ] Map: *let the user map the documents*
- [ ] QueryMap: *let the user map the query to add chain calls*
- [ ] Filter: *filter documents and search more to reach the limit*
- [ ] beforeCursor: *cursor for before request*

### License: MIT

---
_Source: https://npm.io/package/sequelize-paginate-cursor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
