gargoyle-postgresql-0.1: Manage PostgreSQL servers with gargoyle

Safe HaskellNone
LanguageHaskell2010

Gargoyle.PostgreSQL

Synopsis

Documentation

defaultPostgres :: Gargoyle ProcessHandle ByteString Source #

A Gargoyle that assumes initdb and postgres are in the path and will perform a 'fast shutdown' on termination (see below).

mkPostgresGargoyle Source #

Arguments

:: FilePath

Path to initdb

-> FilePath

Path to postgres

-> (ProcessHandle -> IO ())

Shutdown function

-> Gargoyle ProcessHandle ByteString

The Gargoyle returned provides to client code the connection string that can be used to connect to the PostgreSQL server

Create a gargoyle by telling it where the relevant PostgreSQL executables are and what it should do in order to shut down the server. This module provides two options: shutdownPostgresSmart and shutdownPostgresFast.

initLocalPostgres Source #

Arguments

:: FilePath

Path to PostgreSQL initdb executable

-> FilePath

Path in which to initialize PostgreSQL Server

-> IO () 

Create a new PostgreSQL database in a local folder. This is a low level function used to define the PostgreSQL Gargoyle.

getLocalPostgresConnectionString :: FilePath -> IO ByteString Source #

Produces the connection string for a local postgresql database. This is a low level function used to define the PostgreSQL Gargoyle

startLocalPostgres Source #

Arguments

:: FilePath

Path to PostgreSQL postgres executable

-> FilePath

Path where the server to start is located

-> IO ProcessHandle

handle of the PostgreSQL server

Start a postgres server that is assumed to be in the given folder. This is a low level function used to define the PostgreSQL Gargoyle

shutdownPostgresSmart Source #

Arguments

:: ProcessHandle

handle of the PostgreSQL server

-> IO () 

Perform a "Smart Shutdown" of Postgres; see http://www.postgresql.org/docs/current/static/server-shutdown.html

shutdownPostgresFast Source #

Arguments

:: ProcessHandle

handle of the PostgreSQL server

-> IO () 

psqlLocal Source #

Arguments

:: Gargoyle pid ByteString

Gargoyle against which to run

-> FilePath

The path to psql

-> FilePath

The path where the managed daemon is expected

-> Maybe String

Optionally provide stdin input instead of an inheriting current stdin. It will have a newline and quit command appended to it.

-> IO () 

Run psql against a Gargoyle managed db.