class Client
extends QueryClient
import { Client } from "https://deno.land/x/postgres@v0.17.1/client.ts";
Clients allow you to communicate with your PostgreSQL database and execute SQL statements asynchronously
import { Client } from "./client.ts";
const client = new Client();
await client.connect();
await client.queryArray`UPDATE MY_TABLE SET MY_FIELD = 0`;
await client.end();
A client will execute all their queries in a sequential fashion, for concurrency capabilities check out connection pools
import { Client } from "./client.ts";
const client_1 = new Client();
await client_1.connect();
// Even if operations are not awaited, they will be executed in the order they were
// scheduled
client_1.queryArray`UPDATE MY_TABLE SET MY_FIELD = 0`;
client_1.queryArray`DELETE FROM MY_TABLE`;
const client_2 = new Client();
await client_2.connect();
// `client_2` will execute it's queries in parallel to `client_1`
const {rows: result} = await client_2.queryArray`SELECT * FROM MY_TABLE`;
await client_1.end();
await client_2.end();
Constructors
new
Client(config?: ClientOptions | ConnectionString)