{"id":13471621,"url":"https://github.com/stablekernel/postgresql-dart","last_synced_at":"2025-12-26T21:32:32.455Z","repository":{"id":53558409,"uuid":"67084787","full_name":"stablekernel/postgresql-dart","owner":"stablekernel","description":"Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.","archived":false,"fork":false,"pushed_at":"2022-09-06T20:25:26.000Z","size":312,"stargazers_count":128,"open_issues_count":38,"forks_count":32,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-30T02:59:51.734Z","etag":null,"topics":["dart","driver","postgresql"],"latest_commit_sha":null,"homepage":"https://www.dartdocs.org/documentation/postgres/latest","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stablekernel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-01T00:47:57.000Z","updated_at":"2024-10-16T11:35:01.000Z","dependencies_parsed_at":"2022-09-11T15:02:49.303Z","dependency_job_id":null,"html_url":"https://github.com/stablekernel/postgresql-dart","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stablekernel%2Fpostgresql-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stablekernel%2Fpostgresql-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stablekernel%2Fpostgresql-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stablekernel%2Fpostgresql-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stablekernel","download_url":"https://codeload.github.com/stablekernel/postgresql-dart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245662862,"owners_count":20652097,"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":["dart","driver","postgresql"],"created_at":"2024-07-31T16:00:47.383Z","updated_at":"2025-12-26T21:32:32.382Z","avatar_url":"https://github.com/stablekernel.png","language":"Dart","readme":"# postgres\n\n[![Build Status](https://travis-ci.org/stablekernel/postgresql-dart.svg?branch=master)](https://travis-ci.org/stablekernel/postgresql-dart) [![codecov](https://codecov.io/gh/stablekernel/postgresql-dart/branch/master/graph/badge.svg)](https://codecov.io/gh/stablekernel/postgresql-dart)\n\nA library for connecting to and querying PostgreSQL databases.\n\nThis driver uses the more efficient and secure extended query format of the PostgreSQL protocol.\n\n## Usage\n\nCreate `PostgreSQLConnection`s and `open` them:\n\n```dart\nvar connection = PostgreSQLConnection(\"localhost\", 5432, \"dart_test\", username: \"dart\", password: \"dart\");\nawait connection.open();\n```\n\nExecute queries with `query`:\n\n```dart\nList\u003cList\u003cdynamic\u003e\u003e results = await connection.query(\"SELECT a, b FROM table WHERE a = @aValue\", substitutionValues: {\n    \"aValue\" : 3\n});\n\nfor (final row in results) {\n  var a = row[0];\n  var b = row[1];\n\n} \n```\n\nReturn rows as maps containing table and column names:\n\n```dart\nList\u003cMap\u003cString, Map\u003cString, dynamic\u003e\u003e\u003e results = await connection.mappedResultsQuery(\n  \"SELECT t.id, t.name, u.name FROM t LEFT OUTER JOIN u ON t.id=u.t_id\");\n\nfor (final row in results) {\n  var tID = row[\"t\"][\"id\"];\n  var tName = row[\"t\"][\"name\"];\n  var uName = row[\"u\"][\"name\"];\n}\n```\n\nExecute queries in a transaction:\n\n```dart\nawait connection.transaction((ctx) async {\n    var result = await ctx.query(\"SELECT id FROM table\");\n    await ctx.query(\"INSERT INTO table (id) VALUES (@a:int4)\", substitutionValues: {\n        \"a\" : result.last[0] + 1\n    });\n});\n```\n\nSee the API documentation: https://pub.dev/documentation/postgres/latest/\n\n## Features and bugs\n\nPlease file feature requests and bugs at the [issue tracker][tracker].\n\n[tracker]: https://github.com/stablekernel/postgresql-dart/issues\n","funding_links":[],"categories":["Database","数据库"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstablekernel%2Fpostgresql-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstablekernel%2Fpostgresql-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstablekernel%2Fpostgresql-dart/lists"}