1.1.0 • Published 4 years ago

sequelize-batches v1.1.0

Weekly downloads
49
License
Apache-2.0
Repository
github
Last release
4 years ago

Sequelize Batches/Iterators

Note: depends on async generators

works with Node 8.4.0 node --harmony-async-iteration

Install

yarn add sequelize-batches

Below where you have imported sequelize add sequelize-batches

const Sequelize = require('sequelize');
require('sequelize-batches');

Usage

Below example queries using the new syntax

for await (const posts of Post.batch({
  where: { userId: 1 },
  batchSize: 1000 })) {
  for (const post of posts) {
    console.log(post);
  }
}

for await (const post of Post.iterator()) {
  console.log(post);
}

for await (const post of Post.iterator({
  where: {
    id: {
      $gte: 900,
    }
  }
})) {
  console.log(post.title);
}
1.1.0

4 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago