Readme

A helper for writing parameterized Postgres queries for Supabase.

Part of the Supabase guide on docs.val.town.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
export const supaBaseQuery = async (
connectionString: string,
query: string,
args: any[] = [],
) => {
const { Client } = await import(
"https://deno.land/x/postgres@v0.17.0/mod.ts"
);
const client = new Client(connectionString);
await client.connect();
const result = await client.queryArray(query, args);
await client.end();
return result;
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023