{"id":13479317,"url":"https://github.com/denodrivers/postgres","last_synced_at":"2025-05-14T21:09:24.201Z","repository":{"id":38289556,"uuid":"164329087","full_name":"denodrivers/postgres","owner":"denodrivers","description":"PostgreSQL driver for Deno","archived":false,"fork":false,"pushed_at":"2025-01-31T00:17:31.000Z","size":840,"stargazers_count":618,"open_issues_count":42,"forks_count":95,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-04T19:53:54.512Z","etag":null,"topics":["deno","deno-postgres","denoland","postgres","postgresql","postgresql-driver"],"latest_commit_sha":null,"homepage":"https://denodrivers.github.io/postgres","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denodrivers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-06T17:20:28.000Z","updated_at":"2025-04-04T14:53:31.000Z","dependencies_parsed_at":"2023-12-18T13:43:37.226Z","dependency_job_id":"0ee46864-8814-4161-a3a8-e7c2607b0c09","html_url":"https://github.com/denodrivers/postgres","commit_stats":{"total_commits":385,"total_committers":52,"mean_commits":7.403846153846154,"dds":0.638961038961039,"last_synced_commit":"a2ee14ea969d2ba7bb10d41a3d66599de5fc3f1c"},"previous_names":["buildondata/deno-postgres"],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denodrivers%2Fpostgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denodrivers%2Fpostgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denodrivers%2Fpostgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denodrivers%2Fpostgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denodrivers","download_url":"https://codeload.github.com/denodrivers/postgres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750008,"owners_count":21155682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","deno-postgres","denoland","postgres","postgresql","postgresql-driver"],"created_at":"2024-07-31T16:02:13.527Z","updated_at":"2025-04-13T16:54:06.392Z","avatar_url":"https://github.com/denodrivers.png","language":"TypeScript","readme":"# deno-postgres\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/denodrivers/postgres/ci.yml?branch=main\u0026label=Build\u0026logo=github\u0026style=flat-square)\n[![Discord server](https://img.shields.io/discord/768918486575480863?color=blue\u0026label=Ask%20for%20help%20here\u0026logo=discord\u0026style=flat-square)](https://discord.gg/HEdTCvZUSf)\n[![Manual](https://img.shields.io/github/v/release/denodrivers/postgres?color=orange\u0026label=Manual\u0026logo=deno\u0026style=flat-square)](https://deno-postgres.com)\n[![Documentation](https://img.shields.io/github/v/release/denodrivers/postgres?color=yellow\u0026label=Documentation\u0026logo=deno\u0026style=flat-square)](https://doc.deno.land/https/deno.land/x/postgres/mod.ts)\n[![License](https://img.shields.io/github/license/denodrivers/postgres?color=yellowgreen\u0026label=License\u0026style=flat-square)](LICENSE)\n\nA lightweight PostgreSQL driver for Deno focused on developer experience.\n\n`deno-postgres` is being developed inspired by the excellent work of\n[node-postgres](https://github.com/brianc/node-postgres) and\n[pq](https://github.com/lib/pq).\n\n## Documentation\n\nThe documentation is available on the `deno-postgres` website\n[https://deno-postgres.com/](https://deno-postgres.com/)\n\nJoin the [Discord](https://discord.gg/HEdTCvZUSf) as well! It's a good place to\ndiscuss bugs and features before opening issues.\n\n## Examples\n\n```ts\n// deno run --allow-net --allow-read mod.ts\nimport { Client } from \"https://deno.land/x/postgres/mod.ts\";\n\nconst client = new Client({\n  user: \"user\",\n  database: \"test\",\n  hostname: \"localhost\",\n  port: 5432,\n});\nawait client.connect();\n\n{\n  const result = await client.queryArray(\"SELECT ID, NAME FROM PEOPLE\");\n  console.log(result.rows); // [[1, 'Carlos'], [2, 'John'], ...]\n}\n\n{\n  const result = await client\n    .queryArray`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;\n  console.log(result.rows); // [[1, 'Carlos']]\n}\n\n{\n  const result = await client.queryObject(\"SELECT ID, NAME FROM PEOPLE\");\n  console.log(result.rows); // [{id: 1, name: 'Carlos'}, {id: 2, name: 'Johnru'}, ...]\n}\n\n{\n  const result = await client\n    .queryObject`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;\n  console.log(result.rows); // [{id: 1, name: 'Carlos'}]\n}\n\nawait client.end();\n```\n\n## Contributing\n\n### Prerequisites\n\n- You must have `docker` and `docker-compose` installed on your machine\n\n  - https://docs.docker.com/get-docker/\n  - https://docs.docker.com/compose/install/\n\n- You don't need `deno` installed in your machine to run the tests since it will\n  be installed in the Docker container when you build it. However, you will need\n  it to run the linter and formatter locally\n\n  - https://deno.land/\n  - `deno upgrade --version 1.40.0`\n  - `dvm install 1.40.0 \u0026\u0026 dvm use 1.40.0`\n\n- You don't need to install Postgres locally on your machine to test the\n  library; it will run as a service in the Docker container when you build it\n\n### Running the tests\n\nThe tests are found under the `./tests` folder, and they are based on query\nresult assertions.\n\nTo run the tests, run the following commands:\n\n1. `docker compose build tests`\n2. `docker compose run tests`\n\nThe build step will check linting and formatting as well and report it to the\ncommand line\n\nIt is recommended that you don't rely on any previously initialized data for\nyour tests instead create all the data you need at the moment of running the\ntests\n\nFor example, the following test will create a temporal table that will disappear\nonce the test has been completed\n\n```ts\nDeno.test(\"INSERT works correctly\", async () =\u003e {\n  await client.queryArray(`CREATE TEMP TABLE MY_TEST (X INTEGER);`);\n  await client.queryArray(`INSERT INTO MY_TEST (X) VALUES (1);`);\n  const result = await client.queryObject\u003c{ x: number }\u003e({\n    text: `SELECT X FROM MY_TEST`,\n    fields: [\"x\"],\n  });\n  assertEquals(result.rows[0].x, 1);\n});\n```\n\n### Setting up an advanced development environment\n\nMore advanced features, such as the Deno inspector, test, and permission\nfiltering, database inspection, and test code lens can be achieved by setting up\na local testing environment, as shown in the following steps:\n\n1. Start the development databases using the Docker service with the command\\\n   `docker-compose up postgres_clear postgres_md5 postgres_scram`\\\n   Though using the detach (`-d`) option is recommended, this will make the\n   databases run in the background unless you use docker itself to stop them.\n   You can find more info about this\n   [here](https://docs.docker.com/compose/reference/up)\n2. Set the `DENO_POSTGRES_DEVELOPMENT` environmental variable to true, either by\n   prepending it before the test command (on Linux) or setting it globally for\n   all environments\n\n   The `DENO_POSTGRES_DEVELOPMENT` variable will tell the testing pipeline to\n   use the local testing settings specified in `tests/config.json` instead of\n   the CI settings.\n\n3. Run the tests manually by using the command\\\n   `deno test -A`\n\n## Deno compatibility\n\nDue to breaking changes introduced in the unstable APIs `deno-postgres` uses,\nthere has been some fragmentation regarding what versions of Deno can be used\nalongside the driver.\n\nThis situation will stabilize as `std` and `deno-postgres` approach version 1.0.\n\n| Deno version  | Min driver version | Max driver version | Note                 |\n| ------------- | ------------------ | ------------------ | -------------------- |\n| 1.8.x         | 0.5.0              | 0.10.0             |                      |\n| 1.9.0         | 0.11.0             | 0.11.1             |                      |\n| 1.9.1 and up  | 0.11.2             | 0.11.3             |                      |\n| 1.11.0 and up | 0.12.0             | 0.12.0             |                      |\n| 1.14.0 and up | 0.13.0             | 0.13.0             |                      |\n| 1.16.0        | 0.14.0             | 0.14.3             |                      |\n| 1.17.0        | 0.15.0             | 0.17.1             |                      |\n| 1.40.0        | 0.17.2             |                    | Now available on JSR |\n\n## Breaking changes\n\nAlthough `deno-postgres` is reasonably stable and robust, it is a WIP, and we're\nstill exploring the design. Expect some breaking changes as we reach version 1.0\nand enhance the feature set. Please check the Releases for more info on breaking\nchanges. Please reach out if there are any undocumented breaking changes.\n\n## Found issues?\n\nPlease\n[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with\nany problems with the driver in this repository's issue section. If you would\nlike to help, please look at the\n[issues](https://github.com/denodrivers/postgres/issues) as well. You can pick\nup one of them and try to implement it.\n\n## Contributing guidelines\n\nWhen contributing to the repository, make sure to:\n\n1. All features and fixes must have an open issue to be discussed\n2. All public interfaces must be typed and have a corresponding JSDoc block\n   explaining their usage\n3. All code must pass the format and lint checks enforced by `deno fmt` and\n   `deno lint` respectively. The build will only pass the tests if these\n   conditions are met. Ignore rules will be accepted in the code base when their\n   respective justification is given in a comment\n4. All features and fixes must have a corresponding test added to be accepted\n\n## Maintainers guidelines\n\nWhen publishing a new version, ensure that the `version` field in `deno.json`\nhas been updated to match the new version.\n\n## License\n\nThere are substantial parts of this library based on other libraries. They have\npreserved their individual licenses and copyrights.\n\nEverything is licensed under the MIT License.\n\nAll additional work is copyright 2018 - 2024 — Bartłomiej Iwańczuk, Steven\nGuerrero, Hector Ayala — All rights reserved.\n","funding_links":[],"categories":["TypeScript","Modules"],"sub_categories":["Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenodrivers%2Fpostgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenodrivers%2Fpostgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenodrivers%2Fpostgres/lists"}