[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-217":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":9,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},217,"pgx","jackc\u002Fpgx","jackc","PostgreSQL driver and toolkit for Go",null,"https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx","Go",13908,1056,99,219,0,4,24,138,23,44.07,false,"main","2026-06-12 02:00:10","[![Go Reference](https:\u002F\u002Fpkg.go.dev\u002Fbadge\u002Fgithub.com\u002Fjackc\u002Fpgx\u002Fv5.svg)](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002Fjackc\u002Fpgx\u002Fv5)\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx\u002Factions\u002Fworkflows\u002Fci.yml)\n\n# pgx - PostgreSQL Driver and Toolkit\n\npgx is a pure Go driver and toolkit for PostgreSQL.\n\nThe pgx driver is a low-level, high performance interface that exposes PostgreSQL-specific features such as `LISTEN` \u002F\n`NOTIFY` and `COPY`. It also includes an adapter for the standard `database\u002Fsql` interface.\n\nThe toolkit component is a related set of packages that implement PostgreSQL functionality such as parsing the wire protocol\nand type mapping between PostgreSQL and Go. These underlying packages can be used to implement alternative drivers,\nproxies, load balancers, logical replication clients, etc.\n\n## Example Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com\u002Fjackc\u002Fpgx\u002Fv5\"\n)\n\nfunc main() {\n\t\u002F\u002F urlExample := \"postgres:\u002F\u002Fusername:password@localhost:5432\u002Fdatabase_name\"\n\tconn, err := pgx.Connect(context.Background(), os.Getenv(\"DATABASE_URL\"))\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Unable to connect to database: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tdefer conn.Close(context.Background())\n\n\tvar name string\n\tvar weight int64\n\terr = conn.QueryRow(context.Background(), \"select name, weight from widgets where id=$1\", 42).Scan(&name, &weight)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"QueryRow failed: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(name, weight)\n}\n```\n\nSee the [getting started guide](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx\u002Fwiki\u002FGetting-started-with-pgx) for more information.\n\n## Features\n\n* Support for approximately 70 different PostgreSQL types\n* Automatic statement preparation and caching\n* Batch queries\n* Single-round trip query mode\n* Full TLS connection control\n* Binary format support for custom types (allows for much quicker encoding\u002Fdecoding)\n* `COPY` protocol support for faster bulk data loads\n* Tracing and logging support\n* Connection pool with after-connect hook for arbitrary connection setup\n* `LISTEN` \u002F `NOTIFY`\n* Conversion of PostgreSQL arrays to Go slice mappings for integers, floats, and strings\n* `hstore` support\n* `json` and `jsonb` support\n* Maps `inet` and `cidr` PostgreSQL types to `netip.Addr` and `netip.Prefix`\n* Large object support\n* NULL mapping to pointer to pointer\n* Supports `database\u002Fsql.Scanner` and `database\u002Fsql\u002Fdriver.Valuer` interfaces for custom types\n* Notice response handling\n* Simulated nested transactions with savepoints\n\n## Choosing Between the pgx and database\u002Fsql Interfaces\n\nThe pgx interface is faster. Many PostgreSQL specific features such as `LISTEN` \u002F `NOTIFY` and `COPY` are not available\nthrough the `database\u002Fsql` interface.\n\nThe pgx interface is recommended when:\n\n1. The application only targets PostgreSQL.\n2. No other libraries that require `database\u002Fsql` are in use.\n\nIt is also possible to use the `database\u002Fsql` interface and convert a connection to the lower-level pgx interface as needed.\n\n## Testing\n\nSee [CONTRIBUTING.md](.\u002FCONTRIBUTING.md) for setup instructions.\n\n## Architecture\n\nSee the presentation at Golang Estonia, [PGX Top to Bottom](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=sXMSWhcHCf8) for a description of pgx architecture.\n\n## Supported Go and PostgreSQL Versions\n\npgx supports the same versions of Go and PostgreSQL that are supported by their respective teams. For [Go](https:\u002F\u002Fgolang.org\u002Fdoc\u002Fdevel\u002Frelease.html#policy) that is the two most recent major releases and for [PostgreSQL](https:\u002F\u002Fwww.postgresql.org\u002Fsupport\u002Fversioning\u002F) the major releases in the last 5 years. This means pgx supports Go 1.25 and higher and PostgreSQL 14 and higher. pgx also is tested against the latest version of [CockroachDB](https:\u002F\u002Fwww.cockroachlabs.com\u002Fproduct\u002F).\n\n## Version Policy\n\npgx follows semantic versioning for the documented public API on stable releases. `v5` is the latest stable major version.\n\n## PGX Family Libraries\n\n### [github.com\u002Fjackc\u002Fpglogrepl](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpglogrepl)\n\npglogrepl provides functionality to act as a client for PostgreSQL logical replication.\n\n### [github.com\u002Fjackc\u002Fpgmock](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgmock)\n\npgmock offers the ability to create a server that mocks the PostgreSQL wire protocol. This is used internally to test pgx by purposely inducing unusual errors. pgproto3 and pgmock together provide most of the foundational tooling required to implement a PostgreSQL proxy or MitM (such as for a custom connection pooler).\n\n### [github.com\u002Fjackc\u002Ftern](https:\u002F\u002Fgithub.com\u002Fjackc\u002Ftern)\n\ntern is a stand-alone SQL migration system.\n\n### [github.com\u002Fjackc\u002Fpgerrcode](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgerrcode)\n\npgerrcode contains constants for the PostgreSQL error codes.\n\n## Adapters for 3rd Party Types\n\n* [github.com\u002Fjackc\u002Fpgx-gofrs-uuid](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-gofrs-uuid)\n* [github.com\u002Fjackc\u002Fpgx-shopspring-decimal](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-shopspring-decimal)\n* [github.com\u002FColeBurch\u002Fpgx-govalues-decimal](https:\u002F\u002Fgithub.com\u002FColeBurch\u002Fpgx-govalues-decimal)\n* [github.com\u002Ftwpayne\u002Fpgx-geos](https:\u002F\u002Fgithub.com\u002Ftwpayne\u002Fpgx-geos) ([PostGIS](https:\u002F\u002Fpostgis.net\u002F) and [GEOS](https:\u002F\u002Flibgeos.org\u002F) via [go-geos](https:\u002F\u002Fgithub.com\u002Ftwpayne\u002Fgo-geos))\n* [github.com\u002Fvgarvardt\u002Fpgx-google-uuid](https:\u002F\u002Fgithub.com\u002Fvgarvardt\u002Fpgx-google-uuid)\n\n\n## Adapters for 3rd Party Tracers\n\n* [github.com\u002Fjackhopner\u002Fpgx-xray-tracer](https:\u002F\u002Fgithub.com\u002Fjackhopner\u002Fpgx-xray-tracer)\n* [github.com\u002Fexaring\u002Fotelpgx](https:\u002F\u002Fgithub.com\u002Fexaring\u002Fotelpgx)\n\n## Adapters for 3rd Party Loggers\n\nThese adapters can be used with the tracelog package.\n\n* [github.com\u002Fjackc\u002Fpgx-go-kit-log](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-go-kit-log)\n* [github.com\u002Fjackc\u002Fpgx-log15](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-log15)\n* [github.com\u002Fjackc\u002Fpgx-logrus](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-logrus)\n* [github.com\u002Fjackc\u002Fpgx-zap](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-zap)\n* [github.com\u002Fjackc\u002Fpgx-zerolog](https:\u002F\u002Fgithub.com\u002Fjackc\u002Fpgx-zerolog)\n* [github.com\u002Fmcosta74\u002Fpgx-slog](https:\u002F\u002Fgithub.com\u002Fmcosta74\u002Fpgx-slog)\n* [github.com\u002Fkataras\u002Fpgx-golog](https:\u002F\u002Fgithub.com\u002Fkataras\u002Fpgx-golog)\n\n## 3rd Party Libraries with PGX Support\n\n### [github.com\u002Fpashagolub\u002Fpgxmock](https:\u002F\u002Fgithub.com\u002Fpashagolub\u002Fpgxmock)\n\npgxmock is a mock library implementing pgx interfaces.\npgxmock has one and only purpose - to simulate pgx behavior in tests, without needing a real database connection.\n\n### [github.com\u002Fgeorgysavva\u002Fscany](https:\u002F\u002Fgithub.com\u002Fgeorgysavva\u002Fscany)\n\nLibrary for scanning data from a database into Go structs and more.\n\n### [github.com\u002Fvingarcia\u002Fksql](https:\u002F\u002Fgithub.com\u002Fvingarcia\u002Fksql)\n\nA carefully designed SQL client for making using SQL easier,\nmore productive, and less error-prone on Golang.\n\n### [github.com\u002Fotan\u002Fgopgkrb5](https:\u002F\u002Fgithub.com\u002Fotan\u002Fgopgkrb5)\n\nAdds GSSAPI \u002F Kerberos authentication support.\n\n### [github.com\u002Fwcamarao\u002Fpmx](https:\u002F\u002Fgithub.com\u002Fwcamarao\u002Fpmx)\n\nExplicit data mapping and scanning library for Go structs and slices.\n\n### [github.com\u002Fstephenafamo\u002Fscan](https:\u002F\u002Fgithub.com\u002Fstephenafamo\u002Fscan)\n\nType safe and flexible package for scanning database data into Go types.\nSupports, structs, maps, slices and custom mapping functions.\n\n### [github.com\u002Fz0ne-dev\u002Fmgx](https:\u002F\u002Fgithub.com\u002Fz0ne-dev\u002Fmgx)\n\nCode first migration library for native pgx (no database\u002Fsql abstraction).\n\n### [github.com\u002Famirsalarsafaei\u002Fsqlc-pgx-monitoring](https:\u002F\u002Fgithub.com\u002Famirsalarsafaei\u002Fsqlc-pgx-monitoring)\n\nA database monitoring\u002Fmetrics library for pgx and sqlc. Trace, log and monitor your sqlc query performance using OpenTelemetry.\n\n### [https:\u002F\u002Fgithub.com\u002Fnikolayk812\u002Fpgx-outbox](https:\u002F\u002Fgithub.com\u002Fnikolayk812\u002Fpgx-outbox)\n\nSimple Golang implementation for transactional outbox pattern for PostgreSQL using jackc\u002Fpgx driver.\n\n### [https:\u002F\u002Fgithub.com\u002FArlandaren\u002FpgxWrappy](https:\u002F\u002Fgithub.com\u002FArlandaren\u002FpgxWrappy)\n\nSimplifies working with the pgx library, providing convenient scanning of nested structures.\n\n### [https:\u002F\u002Fgithub.com\u002FKoNekoD\u002Fpgx-colon-query-rewriter](https:\u002F\u002Fgithub.com\u002FKoNekoD\u002Fpgx-colon-query-rewriter)\n\nImplementation of the pgx query rewriter to use ':' instead of '@' in named query parameters.\n","pgx 是一个针对 Go 语言的 PostgreSQL 驱动程序和工具包。它提供了一个高性能的低级接口，支持 PostgreSQL 特有的功能如 `LISTEN`\u002F`NOTIFY` 和 `COPY`，并且包含了一个标准 `database\u002Fsql` 接口的适配器。该项目还提供了丰富的工具包，用于解析 PostgreSQL 的协议、类型映射等，可用于开发替代驱动程序、代理、负载均衡器或逻辑复制客户端等。pgx 适合那些仅针对 PostgreSQL 数据库的应用场景，特别是需要利用 PostgreSQL 特性而不需要兼容其他数据库系统的项目。",2,"2026-06-11 02:31:36","trending"]