Install
Start hereYou need opam, OCaml’s package manager, and OCaml 5.5 or later.
1. Install opam
Section titled “1. Install opam”brew install opambash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"2. Set up OCaml
Section titled “2. Set up OCaml”opam initeval $(opam env)Answer yes when opam init offers to set up your shell. It installs the
latest OCaml, which takes a few minutes. If you had opam already, check
ocaml -version; older than 5.5, make a switch with the latest OCaml:
opam switch create rowtype ocaml-base-compilereval $(opam env)3. Install rowtype
Section titled “3. Install rowtype”opam repo add hypha https://github.com/hyphatech/opam-repository.gitopam install rowtype rowtype-postgres rowtype-migrate # Postgresopam install rowtype rowtype-sqlite rowtype-migrate # SQLite, through its C library| Package | What it is |
|---|---|
rowtype |
queries described once; links no database library |
rowtype-postgres |
the Postgres backend, over postgres-eio |
rowtype-sqlite |
the SQLite backend, over the sqlite3 binding |
rowtype-migrate |
the migrations and the rowtype-migrate command, for each dialect installed beside it |
rowtype-migrate migrates the dialects whose backend is installed beside
it, and links no other: its libraries are rowtype-migrate.postgres and
rowtype-migrate.sqlite, each built where its backend is.
rowtype-sqlite links your system’s SQLite. Where it is missing, opam
offers to install it with your system’s package manager.
4. Name the libraries
Section titled “4. Name the libraries”A program names the libraries it uses in its dune file. On Postgres:
(libraries rowtype rowtype-postgres eio_main)On SQLite:
(libraries rowtype rowtype-sqlite eio_main)The quick start writes a whole program, next.
