deno-postgres

Build Status Gitter chat

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.

To Do:

  • connecting to database
  • password handling:
    • cleartext
    • MD5
  • DSN style connection parameters
  • reading connection parameters from environmental variables
  • termination of connection
  • simple queries (no arguments)
  • parsing Postgres data types to native TS types
  • row description
  • parametrized queries
  • connection pooling
  • parsing error response
  • SSL (waiting for Deno to support TLS)
  • tests, tests, tests

Example

import { Client } from "https://deno.land/x/postgres/mod.ts";

async function main() {
  const client = new Client({
    user: "user",
    database: "test",
    host: "localhost",
    port: "5432"
  });
  await client.connect();
  const result = await client.query("SELECT * FROM people;");
  console.log(result.rows);
  await client.end();
}

main();

Docs

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

Contributing guidelines

When contributing to repository make sure to:

a) open an issue for what you're working on

b) use strict mode in TypeScript code (use tsconfig.test.json configuration)

$ deno run -c tsconfig.test.json -A test.ts

c) properly format code using deno fmt

$ deno fmt -- --check

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 - 2019 — Bartłomiej Iwańczuk — All rights reserved.