A framework of packages for building Haskell applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Peter J. Jones df92177b15
Replace all uses of PGJson with SqlJsonb
3 weeks ago
..
example Rename CanOpaleye to MonadOpaleye and export the runOpaleye function 4 weeks ago
src/Iolaus Replace all uses of PGJson with SqlJsonb 3 weeks ago
test Add the Newtype module for generating newtype instances 4 months ago
.envrc Update build files to match latest release of nix-hs 1 month ago
CHANGELOG.md Add Iolaus.Opaleye.Config 5 months ago
LICENSE Build with nix, fix duplicate LICENSE file to make nix/cabal happy 4 months ago
README.md Fix a couple typos, improve the shell.nix file 4 months ago
Setup.hs Add Iolaus.Opaleye.Config 5 months ago
default.nix Update build files to match latest release of nix-hs 1 month ago
iolaus-opaleye.cabal Incorporate the zxcvbn password strength estimation algorithm 4 weeks ago
shell.nix Update build files to match latest release of nix-hs 1 month ago

README.md

Iolaus.Opaleye

The goal of this library is to provide a simple wrapper around the opaleye and postgresql-simple packages without leaking a MonadIO interface into your application’s monad, all while exposing an mtl + lens style of composing the major components of an application.

Using this library is fairly straight forward:

  1. Create your monad transformer stack and then make it an instance of AsOpaleyeError and HasOpaleye.

  2. Parse a Config value from a configuration file.

  3. Call initOpaleye to create the MonadReader value you`ll need.

  4. Use the query functions inside your transformer stack!

For more details, including a tutorial, please see the example.hs file that is part of this distribution.

Running the Example

To run the example application you first need to set two environment variables:

  • DB_CONN: The PostgreSQL database connection string. Create a database with any name you like, then set this variable.

  • iolaus_opaleye_datadir: The path to the directory containing this README.md file. This is so the example application can find the schema migration files.

Examples of these environment variables can be found in the top-level .envrc file.