Socket
Socket
Sign inDemoInstall

oly-sqlize

Package Overview
Dependencies
22
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    oly-sqlize

Library of Sequelize tools


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
7.53 MB
Created
Weekly downloads
 

Readme

Source

Add curser based pagination to sequelize

Installation

npm install oly-sqlize

Example

  // In sequelize models index.js

  // es6 modules
  import { Paginator } from 'oly-sqlize';

  // commonjs
  const Paginator = require('oly-sqlize').Paginator;

  // Using object destructuring
  const { Paginator } = require('oly-sqlize');


  // Add pagination options
  const paginationOptions = {
    methodName: 'paginate',
    primaryKeyField: 'id',
  };

  const addModelPagination = Paginator(paginationOptions);

  // Attach to all your models
  Object.keys(db).forEach((modelName) => {
    if (db[modelName].associate) {
      db[modelName].associate(db);
      addModelPagination(db[modelName]);
    }
  });

This package was inspired by https://github.com/Kaltsoon/sequelize-cursor-pagination

Keywords

FAQs

Last updated on 27 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc