{"id":30180637,"url":"https://github.com/buildondata/deno-postgres","last_synced_at":"2025-08-12T08:01:59.643Z","repository":{"id":38289556,"uuid":"164329087","full_name":"denodrivers/postgres","owner":"denodrivers","description":"PostgreSQL driver for Deno","archived":false,"fork":false,"pushed_at":"2025-04-24T10:41:41.000Z","size":1381,"stargazers_count":639,"open_issues_count":36,"forks_count":94,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-08-11T18:14:42.430Z","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,"zenodo":null}},"created_at":"2019-01-06T17:20:28.000Z","updated_at":"2025-07-26T12:04:14.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":55,"template":false,"template_full_name":null,"purl":"pkg:github/denodrivers/postgres","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","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denodrivers%2Fpostgres/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-12T08:01:29.591Z","updated_at":"2025-08-12T08:01:59.621Z","avatar_url":"https://github.com/denodrivers.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n# deno-postgres\n\n\u003cimg src=\"./docs/deno-postgres.png\" width=\"164\" style=\"padding-bottom:20px;\" /\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\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=Join%20us\u0026logo=discord\u0026style=flat-square)](https://discord.com/invite/HEdTCvZUSf)\n[![JSR](https://jsr.io/badges/@db/postgres?style=flat-square)](https://jsr.io/@db/postgres)\n[![JSR Score](https://jsr.io/badges/@db/postgres/score?style=flat-square)](https://jsr.io/@db/postgres)\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://jsr.io/@db/postgres/doc)\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`deno-postgres` is 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\u003c/div\u003e\n\n## Documentation\n\nThe documentation is available on the\n[`deno-postgres`](https://deno-postgres.com/) website.\n\nJoin the [Discord](https://discord.com/invite/HEdTCvZUSf) as well! It's a good\nplace to discuss bugs and features before opening issues.\n\n## Examples\n\n```ts\n// deno run --allow-net --allow-read mod.ts\nimport { Client } from \"jsr:@db/postgres\";\n\nconst client = new Client({\n  user: \"user\",\n  database: \"test\",\n  hostname: \"localhost\",\n  port: 5432,\n});\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## 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 `deno-postgres` approach version 1.0.\n\n| Deno version  | Min driver version | Max 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             | 0.19.3      | 0.19.3 and down are available in [deno.land](https://deno.land/x/postgres) |\n| 2.0.0 and up  | 0.19.4             | -           | Available on JSR! [`@db/postgres`](https://jsr.io/@db/postgres)            |\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\n[Releases](https://github.com/denodrivers/postgres/releases) for more info on\nbreaking changes. Please reach out if there are any undocumented breaking\nchanges.\n\n## Found issues?\n\nPlease\n[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with\nany problems with the driver. If you would like to help, please look at the\nissues as well. You can pick up one of them and try to implement it.\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 stable`\n  - `dvm install stable \u0026\u0026 dvm use stable`\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 temporary table that will\ndisappear once 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## 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 - 2025 — Bartłomiej Iwańczuk, Steven\nGuerrero, Hector Ayala — All rights reserved.\n","funding_links":[],"categories":["Modules","Uncategorized","基础设施"],"sub_categories":["Online Playgrounds","Assistants","Uncategorized","Deno 源"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildondata%2Fdeno-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuildondata%2Fdeno-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildondata%2Fdeno-postgres/lists"}