@hackage / gargoyle-postgresql

Manage PostgreSQL servers with gargoyle

Latest0.2.0.4

About

Metadata

  • Last updated , by alexfmpe
  • License BSD-3-Clause
  • Categories Databases
  • Maintained by: maintainer@obsidian.systems

  • Lottery factor: 4

Links

Installation

Tested Compilers

  1. 9.12.2
  2. 9.10.1
  3. 9.8.2
  4. 9.0.2
  5. 8.10.7
  6. 8.8.4
  7. 8.6.5

Package Flags

Use the -f option with cabal commands to enable flags

    enable-psql-test (off by default)

Readme

This package provides tools for managing PostgreSQL servers that live in local folders and communicate via a Unix domain socket. It uses the gargoyle package in order to automatically initialize, spin up, and spin down such servers according to client demand.

The `gargoyle-psql` executable is such a client which will try to connect to a PostgreSQL server at a given location:

gargoyle-psql db
psql (9.5.6)
Type "help" for help.

postgres=#

Note that `gargoyle-psql` assumes that PostgreSQL executables such as psql are available on the PATH. A custom Gargoyle is required to use non-standard PostgreSQL installations.

The following is an example of using this package to run postgresql-simple actions using a local DB:

import Database.PostgreSQL.Simple
import Gargoyle
import Gargoyle.PostgreSQL

withDb :: String -> (Connection -> IO a) -> IO a
withDb dbPath a = withGargoyle defaultPostgres dbPath $ \dbUri -> a =<< connectPostgreSQL dbUri