node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

Return the client instance in the `connect()` method

Open franciscop opened this issue 1 month ago • 0 comments

Note: I open this PR as a conversation starter, I've explained my reasoning in a Redis Issue here. I'd be happy to open an issue instead, but I thought showing the code would be faster/easier.

I'd like to suggest returning the client instance in the .connect() method, so that we can create a client in a single step:

const client = await new Client().connect();

If this change is welcome, I'd be happy to add more things to this PR like testing, documentation, etc.

franciscop avatar Nov 26 '25 13:11 franciscop