Author here! Thanks for sharing :)
Which language is this?
let points = 0;
const usrs = await sql`select * from usr where country = 'JP'`;
for (const usr of usrs) {
points += usr.points;
}
I like the approach of not having an ORM to learn.It's JS with the wonderful Postgres.js package!
[1] https://github.com/porsager/postgres
Here's an example where it really shines:
const users = [
{ name: 'Murray', age: 68 },
{ name: 'Walter', age: 80 },
];
await sql`insert into users ${ sql(users) }`;