Monday, May 30, 2022

Postgres.js

Postgres.js with Rasmus Porsager (JS Party #221) |> Changelog podcast    

Postgres.js –the fastest full-featured PostgreSQL client for Node.js and Deno.
 
// users.js
import sql from './db.js'

async function getUsersOver(age) {
  const users = await sql`
    select
      name,
      age
    from users
    where age > ${ age }
  `
  // users = Result [{ name: "Walter", age: 80 }, { name: 'Murray', age: 68 }, ...]
  return users
}

No comments: