Skip to content

gigigoapps/sequelize-pg-stream

 
 

Repository files navigation

sequelize-pg-stream

Make model classes streamable when using PG, adding .findAllStream function.

Getting Started

To install:

npm i --save sequelize-pg-stream

Stream support for model:

const Sequelize = require('sequelize')
const sequelizePgStream = require('sequelize-pg-stream')

const sequelize = new Sequelize('database', 'username', 'password', {/*options*/})

const Items = sequelize.define('items',{
  n: sequelize.INTEGER,
  s: {
    type: sequelize.STRING,
    primaryKey: true
})

sequelizePgStream.streamFromModel(Items)

await sequelize.sync()

const itemsStream = await Items.findAllStream()

itemsStream
.on('data', (itemModel) => {
  // do somethings
})
.pipe(/* do somethings */)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.5%
  • Shell 14.5%