From 40488070b8bbae853a75ebe7d82a6cff6c8d071d Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Thu, 22 Dec 2022 10:54:10 +0800 Subject: [PATCH] fix: export pool getter from rds client (#102) --- lib/client.js | 4 ++++ test/client.test.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/client.js b/lib/client.js index f9802e0..3111367 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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, diff --git a/test/client.test.js b/test/client.test.js index d125110..229b651 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -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);