Skip to main content

@db/postgres@0.19.5
Built and signed on GitHub Actions

Works with
This package works with Deno
This package works with Deno
JSR Score100%
Downloads44/wk
Published11 months ago (0.19.5)

Lightweight PostgreSQL driver for Deno

class Client
extends QueryClient

Clients allow you to communicate with your PostgreSQL database and execute SQL statements asynchronously

import { Client } from "jsr:@db/postgres"; const client = new Client(); await client.connect(); await client.queryArray`SELECT * FROM CLIENTS`; await client.end(); 

A client will execute all their queries in a sequential fashion, for concurrency capabilities check out connection pools

import { Client } from "jsr:@db/postgres"; 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`DELETE FROM CLIENTS`; 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 CLIENTS`; await client_1.end(); await client_2.end(); 

Constructors

Create a new client

Add Package

deno add jsr:@db/postgres 

Import symbol

import { Client } from "@db/postgres"; 
or

Import directly with a jsr specifier

import { Client } from "jsr:@db/postgres";