About
Protocol 3.0 and 3.2 over TCP, Unix sockets and TLS, with multi-host failover and load balancing; SCRAM-SHA-256 with channel binding; statement caching, pipelining, COPY and LISTEN/NOTIFY.
A connection pool lends every connection in a clean state. Every failure is a value, and its errors and logs never contain parameters, passwords or message bytes.
Install
From Hypha's opam repository, on OCaml 5.5 or later:
opam repo add hypha https://github.com/hyphatech/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
Ontology
- StatementDatabaseruns on
- MigrationDatabasechanges
- Connection poolDatabaseconnects to
- Health checkDatabasechecks
Build with Hypha.
Talk to us
Bring a product or an idea.
Read the code
The components are open: source, tests and documentation.
Read the principles
The argument in full, in seven propositions.
