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.
https://github.com/porsager/postgres/blob/master/lib/index.j...
I also tend to compose queries out of smaller static parts dynamically, and tagged syntax does seem to make that hard.
Patterns like:
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.