Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-using-bluebird

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-using-bluebird - npm Package Compare versions

Comparing version 3.2.1 to 3.3.1

12

index.js

@@ -189,4 +189,7 @@ "use strict"; // eslint-disable-line semi

return {
pool: pool,
getConnection: getConnectionWithEnv,
getTransaction: getTransactionWithEnv,
withConnection: withConnection,
withTransaction: withTransaction,
queryAsync: queryRowsWithEnv,

@@ -200,2 +203,3 @@ queryRowsAsync: queryRowsWithEnv,

function getConnectionWithEnv() { return getConnection(queryConfig, connectMultiArgAsync) }

@@ -214,2 +218,10 @@

}
function withConnection(statements) {
return using(getConnectionWithEnv(), statements)
}
function withTransaction(statements) {
return using(getTransactionWithEnv(), statements)
}
}

2

package.json
{
"name": "pg-using-bluebird",
"version": "3.2.1",
"version": "3.3.1",
"description": "Helpers for managing PostgreSQL connections",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -148,2 +148,26 @@ "use strict"; // eslint-disable-line semi

describe('withConnection', function () {
it('wraps using() and getConnection()', function () {
return pgrmWithDefaults.withConnection(assertResponseObj)
})
it('does not rollback errors', function () {
return pgrmWithDefaults.withConnection(function (conn) {
return insert1IntoFoo(conn).then(throwAnError)
}).catch(assertOneEventuallyInFoo)
})
})
describe('withTransaction', function () {
it('wraps using() and getTransaction()', function () {
return pgrmWithDefaults.withTransaction(assertResponseObj)
})
it('rolls back the transaction if the function throws', function () {
return pgrmWithDefaults.withTransaction(function (tx) {
return insert1IntoFoo(tx).then(throwAnError)
}).catch(assertFooIsEventuallyEmpty)
})
})
function insert1IntoFoo(connOrTx) {

@@ -150,0 +174,0 @@ return connOrTx.queryAsync("insert into foo(bar) values (1)")

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc