knex-increment-upsert 👋
knex insert and on duplicate key update & increment
🔗 Link
📥 Install
npm install knex-increment-upsert
🧩 Requirements
📖 Usage
incrementUpsert(db, tableName, data, incrementColumns?, updateColumns?, trx?)
=> Promise<number[]>
const { incrementUpsert } = require('knex-increment-upsert');
const knex = require('knex');
const db = knex({ ... });
incrementUpsert(
db,
'table1',
{
pk1: 'pk1',
pk2: 'pk2',
inc1: 3,
},
[ 'inc1' ]
);
incrementUpsert(
db,
'table1',
[
{
pk1: '1',
pk2: '1',
inc1: 1,
col1: '1'
},
{
pk1: '2',
pk2: '2',
inc1: 2,
col1: '2'
}
],
[ 'inc1' ],
[ 'col1' ]
);
🙋♂️ Author
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
🌟 Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2021 a179346.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator