GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - hyphatech/postgres-eio: The Postgres driver for modern OCaml.

BranchesTags
Open more actions menu

Latest commit

 

History

136 Commits
136 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
agents
agents
 
 
docs
docs
 
 
examples
examples
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.ocamlformat
.ocamlformat
 
 
AGENTS.md
AGENTS.md
 
 
CHANGES.md
CHANGES.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
compose.yaml
compose.yaml
 
 
dune
dune
 
 
dune-project
dune-project
 
 
postgres-eio.opam
postgres-eio.opam
 
 
postgres-eio.opam.template
postgres-eio.opam.template
 
 

Repository files navigation

postgres-eio

ci release license OCaml 5.5+ Hypha Stack

The Postgres driver for modern OCaml. Fast, secure and feature-complete. Eio-native and multicore-ready.

Documentation: hyphatech.github.io/postgres-eio

Features

  • Secure by default: TLS, SCRAM-SHA-256 with channel binding and client certificates; a connection that crosses a network is encrypted unless its string says otherwise.
  • Pool and failover: one pool serves every domain, across several hosts, with failover and load balancing.
  • One round trip: statement caching, pipelining and batches.
  • Streams: COPY in and out, and rows folded as they arrive, never buffered.
  • LISTEN/NOTIFY: a listener that reconnects by itself and says so.
  • Failures you can act on: each says whether the statement may have run, so a retry is never blind.

Install

opam repo add open-opam https://github.com/open-opam/opam-repository.git
opam install postgres-eio
(libraries postgres-eio eio_main)

Example

let () =
  Eio_main.run @@ fun env ->
  Eio.Switch.run @@ fun sw ->
  match Postgres_eio.Conninfo.of_string "postgres://app@localhost/shop" with
  | Error e -> prerr_endline e
  | Ok conninfo -> (
      match
        Postgres_eio.connect ~sw ~net:(Eio.Stdenv.net env)
          ~mono_clock:(Eio.Stdenv.mono_clock env)
          conninfo
      with
      | Error e -> prerr_endline (Postgres_eio.error_to_string e)
      | Ok conn ->
          (match
             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)
           with
          | Ok (names, _tag) -> List.iter print_endline names
          | Error e -> prerr_endline (Postgres_eio.error_to_string e));
          Postgres_eio.close conn)

With an agent

postgres-eio installs its documentation at $(opam var postgres-eio:doc): each page of the site as Markdown, and llms.txt, which lists them. Your agent reads it when told to, in a line in your project's AGENTS.md:

Before writing code with postgres-eio, read `$(opam var postgres-eio:doc)/llms.txt` and
the pages it lists for the parts you need, and use those parts rather than
writing your own.

Contributing

See AGENTS.md.

Licence

MIT, copyright Hypha Technologies Ltd. See LICENSE.

About

The Postgres driver for modern OCaml.

hyphatech.github.io/postgres-eio/

Topics

database-drivereioocamlocaml5postgrespostgresql

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.