About
Fast, secure and feature-complete. TLS, SCRAM-SHA-256 with channel binding and client certificates, and a connection that crosses a network is encrypted unless its string says otherwise. One pool serves every domain, across several hosts, with failover and load balancing.
Statement caching, pipelining and batches keep work to one round trip. COPY streams in and out, rows are folded as they arrive, and LISTEN/NOTIFY reconnects by itself. Every failure says whether the statement may have run, so a retry is never blind.
Install
From open-opam, on OCaml 5.5 or later:
opam repo add open-opam https://github.com/open-opam/opam-repository.git
opam install postgres-eioThen in your dune file:
(libraries postgres-eio eio_main)In code
A query, its rows folded as they arrive and never buffered.
let names = Postgres_eio.query conn "select name from customers where country = $1" ~params:[ Some "GB" ] ~init:[] ~row:(fun names row -> match row with [| Some name |] -> name :: names | _ -> names)Both libpq forms of connection string. With none given, a connection that crosses a network is encrypted.
postgres://user:pass@host:5432/db?sslmode=require host=db user=app sslmode=require
Build with Hypha.
Talk to us
Bring an idea, a product or a system. Questions and feedback are just as welcome.
Services
A new product built to last, or the system your business runs on rebuilt. Hypha's expertise and its foundation, end to end.
The Factory
Make the decisions and let Hypha Autonomous Factory do the rest, turning them into a tested release, ready to ship.