Skip to content

anthonyyuan/postgres

 
 

Repository files navigation

deno-postgres

Build Status Discord server Manual Documentation License

PostgreSQL driver for Deno.

It's still work in progress, but you can take it for a test drive!

deno-postgres is being developed based on excellent work of node-postgres and pq.

Example

// deno run --allow-net --allow-read --unstable mod.ts
import { Client } from "https://deno.land/x/postgres/mod.ts";

const client = new Client({
  user: "user",
  database: "test",
  hostname: "localhost",
  port: 5432,
});
await client.connect();

{
  const result = await client.queryArray("SELECT ID, NAME FROM PEOPLE");
  console.log(result.rows); // [[1, 'Carlos'], [2, 'John'], ...]
}

{
  const result = await client.queryObject("SELECT ID, NAME FROM PEOPLE");
  console.log(result.rows); // [{id: 1, name: 'Carlos'}, {id: 2, name: 'Johnru'}, ...]
}

await client.end();

Unstable

Due to the use of the Deno.startTls API, the library require to pass the --unstable for it's usage. This is a situation that will be solved when that API is stabilized.

Docs

Docs are available at https://deno-postgres.com/

Contributing guidelines

When contributing to repository make sure to:

  1. All features and fixes must have an open issue in order to be discussed
  2. All public interfaces must be typed and have a corresponding JS block explaining their usage
  3. All code must pass the format and lint checks enforced by deno fmt and deno lint respectively

License

There are substantial parts of this library based on other libraries. They have preserved their individual licenses and copyrights.

Eveything is licensed under the MIT License.

All additional work is copyright 2018 - 2021 — Bartłomiej Iwańczuk and Steven Guerrero — All rights reserved.

About

PostgreSQL driver for Deno

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%