{"id":33239347,"url":"https://github.com/arenadotio/pgx","last_synced_at":"2025-11-21T13:02:15.910Z","repository":{"id":39582942,"uuid":"115010239","full_name":"arenadotio/pgx","owner":"arenadotio","description":"A pure OCaml PostgreSQL client library","archived":false,"fork":false,"pushed_at":"2022-10-26T21:16:00.000Z","size":484,"stargazers_count":121,"open_issues_count":17,"forks_count":14,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-05-03T00:52:51.474Z","etag":null,"topics":["ocaml","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arenadotio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-21T13:44:37.000Z","updated_at":"2024-01-01T20:09:59.000Z","dependencies_parsed_at":"2022-09-04T09:50:27.492Z","dependency_job_id":null,"html_url":"https://github.com/arenadotio/pgx","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/arenadotio/pgx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadotio%2Fpgx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadotio%2Fpgx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadotio%2Fpgx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadotio%2Fpgx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arenadotio","download_url":"https://codeload.github.com/arenadotio/pgx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arenadotio%2Fpgx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285620632,"owners_count":27203062,"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-11-21T02:00:06.175Z","response_time":61,"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":["ocaml","postgresql"],"created_at":"2025-11-16T19:00:41.512Z","updated_at":"2025-11-21T13:02:15.905Z","avatar_url":"https://github.com/arenadotio.png","language":"OCaml","funding_links":[],"categories":["Databases"],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/arenadotio/pgx.svg?style=shield)](https://circleci.com/gh/arenadotio/pgx)\n[![Coverage Status](https://coveralls.io/repos/github/arenadotio/pgx/badge.svg?branch=master)](https://coveralls.io/github/arenadotio/pgx?branch=master)\n[![Documentation](https://img.shields.io/badge/documentation-odoc-blue)](https://arenadotio.github.io/pgx/index.html)\n\nPGX is a pure-OCaml PostgreSQL client library, supporting Async, LWT, or\nsynchronous operations.\n\nThis library focuses on correctness and safety, with features like:\n\n - It is nearly impossible to try to execute a prepared statement that hasn't\n   been prepared.\n - Trying to run multiple queries at the same time will work properly (although\n   there's no performance benefit, since we currently don't send queries in\n   parallel).\n - Lots of automated tests.\n - `Pgx.Value` for parameters and returned data, encouraging people to use\n   the built-in converters instead of trying to handle everything as a string.\n - Async and LWT support are built in, no need to write your own IO module.\n - Mirage OS is supported via Pgx_lwt_mirage\n\nWe also provide a relatively high-level interface, like `Pgx_async.execute_pipe`,\nwhich prepares a statement, executes it with the given parameters, returns an\n`Async.Pipe.Reader.t` (so you can stream results), and unprepares the statement\nwhen the query is finished.\n\nSignificant portions of the code come from [PG'Ocaml](http://pgocaml.forge.ocamlcore.org/).\n\n## Setup\n\n```\nopam install pgx_async # or pgx_lwt_unix or pgx_unix or pgx_lwt_mirage\n```\n\n## Examples\n\nSee [pgx_async/bin/pgx_async_example.ml](pgx_async/bin/pgx_async_example.ml) for\na complete example of the high-level functional interface. To translate the\nexample to Lwt, replace `Pgx_async` with `Pgx_lwt` and `\u003e\u003e|` with `\u003e|=`. To\ntranslate it to synchronous IO / standard-library-only, use `Pgx_unix` and\nreplace both `\u003e\u003e|` and `\u003e\u003e=` with `|\u003e`, or just replace `\u003e\u003e| fun () -\u003e` with `;`.\n\nI.e. in `Pgx_unix`, you can replace:\n\n```ocaml\nPgx_async.execute ~params \"INSERT INTO ...\"\n\u003e\u003e| fun () -\u003e\n```\n\n... with:\n\n```ocaml\nPgx_unix.execute ~params \"INSERT INTO ...\";\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farenadotio%2Fpgx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farenadotio%2Fpgx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farenadotio%2Fpgx/lists"}