Skip to content

Commit

Permalink
fix: export pool getter from rds client (ali-sdk#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 22, 2022
1 parent ceb21c7 commit 4048807
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class RDSClient extends Operator {
return await this.#pool.query(sql);
}

get pool() {
return this.#pool;
}

get stats() {
return {
acquiringConnections: this.#pool._acquiringConnections.length,
Expand Down
4 changes: 4 additions & 0 deletions test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ describe('test/client.test.js', () => {
});

describe('new RDSClient(options)', () => {
it('should access pool', async () => {
assert(db.pool.config.connectionConfig.database);
});

it('should connect rds success', async () => {
const rows = await db.query('show tables');
// console.log(rows);
Expand Down

0 comments on commit 4048807

Please sign in to comment.