Show HN: Postgres.js – Fast PostgreSQL Client for Node.js
github.com
github.com
I also think I've managed to make a welcoming, simple and safe surface API at the same time, so the postgres experience in Node becomes even nicer. Feedback is very much welcomed.
I found a lot of inspiration for tricks to make it faster in other libraries, but the biggest boost came from following the Postgres protocol docs recommendations.
Another thing I've found since becoming a Postgres user is how amazing their documentation is once you wrap your head around it. It took me a while, probably because I've always been used to quickly scanning documentation for the thing I need, instead of actually reading it. That's a foolish thing to do with the Postgres docs. There is so much useful information in there, so now I just read from top to bottom every time I look at a topic.
I've used pg-promise a lot and this seems to cover a good bit of the core functionality and could be extended pretty well in a project. Do you plan to continue building out features or are you looking to keep this as lean as possible long term?
Also, does sql.file() support named parameters or just indexed parameters (like $1)?
I'll definitely be open to features that improves daily usage, and features that treats SQL as a first class citizen. It'll never turn into an ORM. So if a feature has great value and it doesn't interfere with the core I'm all ears :) Your example with named parameters in sql files is definitely something I'd like to do, since that's not supported currently. You're very welcome to create an issue for it so we can continue that idea there.
As it so happens, I'll be building out a little idea over the holidays, so I'll give more/better feedback after then.
Also, thanks for teaching me about tagged template literals. TIL.
And yeah, I discarded tagged template literals when I first saw them, but they've certainly gained my love + trust since then. There's a really interesting optimization option for them because the first argument (string array) will always be the same instance for the same callsite so you can cache and make things really performant using that.
Is that what you're looking for?