CodeFoodPixels / node-promise-mysql

A wrapper for mysqljs/mysql that wraps function calls with Bluebird promises.
MIT License
338 stars 63 forks source link

TypeScript definitions missing Connection.release() method #73

Closed terbooter closed 6 years ago

terbooter commented 6 years ago

Docs says that

When you are done with a connection, just call connection.release() and the connection will return to the pool, ready to be used again by someone else.

But interface Connection in index.d.ts file miss this method signature

move-zig commented 6 years ago

I don't think there is a connection.release() method. There is a connection.end(). A poolConnection has a release() method and the typings are present for that.

For example,

import * as mysql from 'promise-mysql';

// standard connection
mysql.createConnection({
...
}).then((connection) => {
  connection.end();
});

// pooled connection
const pool = mysql.createPool({
...
});
pool.getConnection().then((connection) => {
  connection.release(); // or pool.releaseConnection(connection);
});
terbooter commented 6 years ago

Sorry, I was inattentive