@goodware/mysql
Advanced tools
Comparing version 1.0.5 to 1.0.6
/* eslint-disable no-param-reassign */ | ||
/* eslint-disable no-await-in-loop */ | ||
@@ -250,3 +251,2 @@ const AWS = require('aws-sdk'); | ||
// 'connection' will be usable if an exception is not thrown | ||
// eslint-disable-next-line no-await-in-loop | ||
connection = await (this.usePool | ||
@@ -257,7 +257,5 @@ ? this.connectionPool.getConnection() | ||
if (useTransaction) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await connection.beginTransaction(); | ||
} else { | ||
// Test the connection | ||
// eslint-disable-next-line no-await-in-loop | ||
await connection.query('SELECT 1'); | ||
@@ -267,6 +265,4 @@ } | ||
// throw new Error('Test scenario 4 - App fails'); | ||
// eslint-disable-next-line no-await-in-loop | ||
const ret = await task(connection); | ||
// throw new Error('Test scenario 1 - Commit fails'); | ||
// eslint-disable-next-line no-await-in-loop | ||
if (useTransaction) await connection.commit(); | ||
@@ -300,3 +296,2 @@ return ret; | ||
// throw new Error('Test scenario 2 - Rollback fails'); | ||
// eslint-disable-next-line no-await-in-loop | ||
await connection.rollback(); | ||
@@ -395,3 +390,2 @@ } catch (error2) { | ||
const delay = delayMs; | ||
// eslint-disable-next-line no-await-in-loop | ||
await new Promise((resolve) => setTimeout(resolve, delay)); | ||
@@ -402,3 +396,2 @@ } finally { | ||
// throw new Error('Test scenario 6 - Release fails'); | ||
// eslint-disable-next-line no-await-in-loop | ||
await (this.usePool ? connection.release() : connection.end()); | ||
@@ -405,0 +398,0 @@ } catch (error) { |
{ | ||
"name": "@goodware/mysql", | ||
"version": "1.0.5", | ||
"description": "Database connection and execution utility for the mysql2 npm package", | ||
"version": "1.0.6", | ||
"description": "A mysql2-based connection helper", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "mysql", |
@@ -1,2 +0,2 @@ | ||
# mysql2 utility for NodeJS | ||
# @goodware/mysql: A mysql2-based connection helper | ||
@@ -21,4 +21,4 @@ Better Documentation is coming | ||
- Creates mysql2-promise Connections, optionally from a pool | ||
- Creates database connections via mysql2-promise, optionally from a pool, with backoff retry | ||
- Handles AWS RDS passwordless IAM connections | ||
- Manages database transactions by wrapping begin/end around a function invocation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14
1485495
1327