Very nice! I'd ditch pg-promise in a heartbeat for something simpler. I kinda dislike the tagged template literal helpers magic. I'd be more comfortable with explicit references to substituted arguments.
Though it seems like I can just use the unsafe api all the time for that.
The rest of the API is very nice, .stream, .cursor, notify support, all that.
I'm curious - What's the reason you don't like the tagged template literal? It's those that give you implicit safe parameters and let's you avoid doing parameter counting when writing queries.
I don't like the sql() helpers part, and that they try to guess whether I want a helper for insert or update, based on some regexes and that helpers for different things all are sql(something) while doing very different things.
I also tend to compose queries out of smaller static parts dynamically, and tagged syntax does seem to make that hard.
Patterns like:
let params = {};
let conds = ['TRUE']
if (some_user_input) {
conds.push('a = $test');
params.test = some_user_input;
}
db.query(`
SELECT cols, ... FROM xxx
WHERE abc AND ${conds.join(' AND ')}
`, params);
Not having a way to compose tagged literals and not having named parameters, only $1 just made it hard to port any of my existing projects based on pg-promise to your library.
I use named parameters, so I don't do parameter counting. Connector does that for me, when rewriting the parameters to native postgresql syntax.
Anyway, I'm a fan of suckless (https://suckless.org/) and I try to use minimum set of dependencies (incl. transitive dependencies) in my node projects too. I like your project a lot from this perspective and that given its small size and lack of dependencies, it's also easily malleable to different needs, than the ones you anticipated.
Though it seems like I can just use the unsafe api all the time for that.
The rest of the API is very nice, .stream, .cursor, notify support, all that.