The primary goal of this refactor is to remove hard dependency on pg.
My intention is to move Slonik away from being a pg wrapper, to make it a universal client. The work in this PR abstracts all interactions with the database behind a pool and drivers (e.g. createPgDriver). This makes it very easy to implement drivers for pg-native, postgres and other drivers.
Drops dependency on pg.Pool
Implements a more efficient internal pooling mechanism.
For context, test execution time dropped from ~50 seconds down to ~6 seconds.
Renames getPoolState() to state()
Removes createMockPool
It was at best not useful, and at worst misleading. Even Slonik itself didn't use it. There are better ways to mock/spy connections. Refer to createPoolWithSpy as one of the possible ways.
Refactors all tests to use database connection instead of mocking.
The primary goal of this refactor is to remove hard dependency on
pg
.My intention is to move Slonik away from being a
pg
wrapper, to make it a universal client. The work in this PR abstracts all interactions with the database behind a pool and drivers (e.g.createPgDriver
). This makes it very easy to implement drivers forpg-native
,postgres
and other drivers.pg.Pool
getPoolState()
tostate()
createMockPool
createPoolWithSpy
as one of the possible ways.