Skip to content

Add pg dependency #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

sjoerdsmink
Copy link
Contributor

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.

@darrachequesne
Copy link
Member

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?

@sjoerdsmink
Copy link
Contributor Author

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

darrachequesne pushed a commit that referenced this pull request Dec 15, 2021
@darrachequesne
Copy link
Member

Well that makes sense! Merged as d6d74d5, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants