gargoyle-postgresql-0.2.0.2: Manage PostgreSQL servers with gargoyle
Safe HaskellNone
LanguageHaskell2010

Gargoyle.PostgreSQL

Synopsis

Documentation

defaultPostgres :: Gargoyle FilePath 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 pg_ctl

-> (FilePath -> FilePath -> IO ())

Shutdown function

-> Gargoyle FilePath 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 pg_ctl 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 pg_ctl executable

-> FilePath

Path where the server to start is located

-> IO FilePath

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

:: FilePath

Path to PostgreSQL pg_ctl executable

-> FilePath

Path where the server to start is located

-> IO () 

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

shutdownPostgresFast Source #

Arguments

:: FilePath

Path to PostgreSQL pg_ctl executable

-> FilePath

Path where the server to start is located

-> IO () 

shutdownPostgresImmediate Source #

Arguments

:: FilePath

Path to PostgreSQL pg_ctl executable

-> FilePath

Path where the server to start is located

-> IO () 

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

shutdownPostgresWithMode Source #

Arguments

:: String

The shutdown mode to execute; see https://www.postgresql.org/docs/9.5/app-pg-ctl.html

-> FilePath

Path to PostgreSQL pg_ctl executable

-> FilePath

Path where the server to start is located

-> 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.

runPgLocalWithSubstitution Source #

Arguments

:: Gargoyle pid ByteString

Gargoyle against which to run

-> FilePath

The path where the managed daemon is expected

-> FilePath

Path to process to run

-> (String -> [String])

Function producing arguments to the process given the connection string

-> Maybe String

Optionally provide stdin input instead of an inheriting current stdin.

-> IO ExitCode 

Run an arbitrary process against a Gargoyle-managed DB, providing connection information by substituting a given argument pattern with the connection string.