node.js - Node.js Sequelize 获取原生池
问题描述
我使用Sequelize
andpg
来查询Postgres
我找到了获得 Sequelize 连接的方法
sequilize.connectionManager.getConnection()
.then((connection) => {})
有什么办法得到pool
吗?
解决方案
There is an option to use pool of connections from Sequelize this way
sequelize.connectionManager.getConnection()
.then((connection) => {
connection.query('SOME SQL;')
.then(() => {
sequilize.connectionManager.releaseConnection(connection);
})
})
It returns connection from the pool and then connection has to be released
推荐阅读
- vbscript - VBScript 错误 800A0401 - 预期语句
- python - 如何在不使用函数代码的情况下在python中找到第n个素数?
- c# - MySql.Data with 'new Thread' vs ThreadPool:使用 ThreadPool 创建死锁
- flutter - 对于颤振两个文本之间的自定义空间的最佳方式
- react-native - 未定义不是对象(评估 this.props.route.params.text)
- c - 使用 malloc 时类型转换指针数组
- python-2.7 - python 2.7.3中的ctypes问题
- javascript - 使用 axios 在 .then() Promise 中访问嵌套 if else 中的返回值
- javascript - 有人可以帮我理解这段 JavaScript 代码吗
- node.js - 如何将 ObjectId 添加到猫鼬中的默认 [Array]?