0.4.0 • Published 6 days ago

@dashdot/cursors v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 days ago

Dashdot Cursors

build codecov

A simple SQL and Mongo implementation of cursor based pagination

Usage

Inside your Node project directory, run the following:

npm i --save @dashdot/cursors

Or with Yarn:

yarn add @dashdot/cursors

API

import { cursorToSqlQuery } from '@dashdot/cursor'
import * as tables from './tables'

const user = await tables.users().fist()
const orderBy = {
    email: 'ASC'
    lastName: 'DESC',
    firstName: 'ASC',
    id: 'DESC',
}
const cursor = createCursor(user, orderBy)
const [
    whereQuery,
    whereValues,
    orderQuery
]  = cursorToSqlQuery(cursor, orderBy)
const nextUser = await tables.users()
    .whereRaw(whereQuery, whereValues)
    .orderByRaw(orderQuery)
    .first()
0.4.0

6 days ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago