new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Supabase · Database · all subjects

connecting/postgres-js

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Postgres.js installation

Install Postgres.js using npm with the command: npm i postgres

Postgres.js connection setup

Create a connection to Supabase using Postgres.js by importing the postgres module, reading the connection string from the DATABASE_URL environment variable, and calling postgres(connectionString) to initialize the connection. The connection string can be obtained from the Supabase dashboard Connect panel.

Postgres.js query execution example

Execute SQL queries using Postgres.js with tagged template literals. Parameters are passed using template interpolation with ${ }. Example: const users = await sql`select name, age from users where age > ${ age }` returns an array of result objects.

Postgres.js export pattern

Export the postgres connection instance as the default export from a db.js module to reuse it across your application.

Give your agent this brain