sequelize-pool
Advanced tools
Comparing version 4.0.0 to 5.0.0
# Changelog | ||
## 4.0.0 | ||
- Flow typed code. API is unchanged. | ||
## v3.1.0 | ||
- added `maxUses` options [#18](https://github.com/sequelize/sequelize-pool/pull/18) |
{ | ||
"name": "sequelize-pool", | ||
"description": "Resource pooling for Node.JS", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"author": "Sushant <sushantdhiman@outlook.com>", | ||
@@ -12,3 +12,3 @@ "keywords": [ | ||
], | ||
"main": "src/Pool.js", | ||
"main": "lib/index.js", | ||
"repository": { | ||
@@ -19,15 +19,18 @@ "type": "git", | ||
"files": [ | ||
"src" | ||
"lib", | ||
"types" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"babel-eslint": "^10.1.0", | ||
"@types/node": "^14.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-flowtype": "^4.7.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"flow-bin": "^0.123.0", | ||
"jsdoc-to-markdown": "^5.0.3", | ||
"prettier": "^2.0.2", | ||
"tap": "^14.10.7" | ||
"tap": "^14.10.7", | ||
"typedoc": "^0.17.7", | ||
"typedoc-plugin-markdown": "^2.2.17", | ||
"typescript": "^3.9.2" | ||
}, | ||
@@ -38,10 +41,13 @@ "engines": { | ||
"scripts": { | ||
"tsc": "tsc", | ||
"test": "npm run lint && npm run test:raw", | ||
"lint": "eslint src test", | ||
"pretty": "prettier src/**/*.js test/**/*.js --write", | ||
"docs": "jsdoc2md src/*.js > API.md", | ||
"test:raw": "tap test/**/*-test.js", | ||
"flow": "flow" | ||
"lint": "eslint --ext .js,.ts src/**/* test/**/*", | ||
"pretty": "prettier src/**/*.ts test/**/*.js --write", | ||
"docs": "typedoc", | ||
"test:raw": "tap test/**/*-test.js" | ||
}, | ||
"prettier": { | ||
"singleQuote": true | ||
}, | ||
"license": "MIT" | ||
} |
@@ -6,7 +6,4 @@ # Sequelize Pool | ||
Resource pool. Can be used to reuse or throttle expensive resources such as | ||
database connections. | ||
Resource pool implementation. It can be used to throttle expensive resources. | ||
Pure JavaScript, ships with Flow typings. | ||
**Note:** | ||
@@ -23,3 +20,3 @@ This is a fork from [generic-pool@v2.5](https://github.com/coopernurse/node-pool/tree/v2.5). | ||
You can find documentation in [API.md](https://github.com/sequelize/sequelize-pool/blob/master/API.md) | ||
You can find full API documentation in [docs/README.md](docs/README.md) | ||
@@ -32,7 +29,7 @@ ## Example | ||
// Create a MySQL connection pool | ||
var Pool = require("sequelize-pool").Pool; | ||
var mysql2 = require("mysql2/promise"); | ||
var Pool = require('sequelize-pool').Pool; | ||
var mysql2 = require('mysql2/promise'); | ||
var pool = new Pool({ | ||
name: "mysql", | ||
name: 'mysql', | ||
create: async () => { | ||
@@ -42,5 +39,5 @@ // create a new connection | ||
return mysql2.createConnection({ | ||
user: "scott", | ||
password: "tiger", | ||
database: "mydb", | ||
user: 'scott', | ||
password: 'tiger', | ||
database: 'mydb', | ||
}); | ||
@@ -64,8 +61,13 @@ }, | ||
// acquire connection | ||
pool.acquire().then((connection) => { | ||
client.query("select * from foo", [], function () { | ||
// return connection back to pool | ||
pool.release(client); | ||
}); | ||
}); | ||
(async () => { | ||
// Get new connection from pool. | ||
// This method can throw TimeoutError if connection was not created in | ||
// specified `factory.acquireTimeoutMillis` time. | ||
const connection = await pool.acquire(); | ||
const result = connection.query('select * from foo'); | ||
// return connection back to pool so it can be reused | ||
pool.release(connection); | ||
})(); | ||
``` | ||
@@ -72,0 +74,0 @@ |
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
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
34693
16
145
11
411