Closed sjoerdsmink closed 2 years ago
That's a fair point. One potential use case is to allow the user to provide another PostgreSQL client: in the case of the Redis adapter for example, you can provide a client from redis
or ioredis
.
Also, it would mean that we force the user to use pg@^8.0.0
, which may not be great. What do you think?
Still if you want to support other pool clients, you need to define the types. Because otherwise this.pool.connect()
and this.pool.query
would crash. The whole code expects pg-node's pool in this argument, e.g. pool.connect()
should return a client, which can have client.query()
, client.removeAllListeners()
, client.release()
, client.on()
. Don't think there's any other package that does exactly that :)
pg@^8.0.0
means pg version 8.x.x. In case a user wants another major version, npm or yarn will install the pg dependency in node_modules/@socket.io/postgres-adapter/node_modules/pg
Well that makes sense! Merged as https://github.com/socketio/socket.io-postgres-adapter/commit/d6d74d51051f46b6f24ba47b4e1e0cd65b2ca2c0, thanks :+1:
The package
pg
is a dependency which is needed. To put this in the devDependencies, but mentioning in the readme that it's required seems contradicting. Also updated the TypeScript reference to pg-pool instead of an any.