tmp-postgres-0.2.0.0: Start and stop a temporary postgres for testing

Safe HaskellNone
LanguageHaskell2010

Database.Postgres.Temp.Internal

Synopsis

Documentation

withLock :: MVar a -> IO b -> IO b Source #

data DB Source #

Constructors

DB 

Fields

data SocketClass Source #

Constructors

Localhost 
Unix 
Instances
Bounded SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Enum SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Eq SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Ord SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Read SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Show SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Generic SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Associated Types

type Rep SocketClass :: Type -> Type #

type Rep SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

type Rep SocketClass = D1 (MetaData "SocketClass" "Database.Postgres.Temp.Internal" "tmp-postgres-0.2.0.0-HXohU4A6IH11w6h0dwcEyn" False) (C1 (MetaCons "Localhost" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Unix" PrefixI False) (U1 :: Type -> Type))

start Source #

Arguments

:: [(String, String)]

Extra options which override the defaults

-> IO (Either StartError DB) 

start postgres and use the current processes stdout and stderr

startLocalhost Source #

Arguments

:: [(String, String)]

Extra options which override the defaults

-> IO (Either StartError DB) 

start postgres and use the current processes stdout and stderr but use TCP on localhost instead of a unix socket.

fourth :: (a, b, c, d) -> d Source #

startWithHandles Source #

Arguments

:: SocketClass 
-> [(String, String)]

Extra options which override the defaults

-> Handle
stdout
-> Handle
stderr
-> IO (Either StartError DB) 

Start postgres and pass in handles for stdout and stderr

reloadConfig :: DB -> IO () Source #

Send the SIGHUP signal to the postgres process to start a config reload

startPostgres :: DB -> IO () Source #

This throws AnotherPostgresProcessActive if the postgres has not been stopped using stopPostgres. This function attempts to the pidLock before running. If postgres process fails this throws StartPostgresFailed. If the postgres process becomes Nothing while starting this function throws StartPostgresDisappeared.

stopPostgres :: DB -> IO (Maybe ExitCode) Source #

Stop the postgres process. This function attempts to the pidLock before running. stopPostgres will terminate all connections before shutting down postgres. stopPostgres is useful for testing backup strategies.

data Event Source #

Instances
Bounded Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Enum Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Eq Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Ord Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Methods

compare :: Event -> Event -> Ordering #

(<) :: Event -> Event -> Bool #

(<=) :: Event -> Event -> Bool #

(>) :: Event -> Event -> Bool #

(>=) :: Event -> Event -> Bool #

max :: Event -> Event -> Event #

min :: Event -> Event -> Event #

Show Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

startAndLogToTmp Source #

Arguments

:: [(String, String)]

Extra options which override the defaults

-> IO (Either StartError DB) 

Start postgres and log it's all stdout to {mainDir}/output.txt and {mainDir}/error.txt

terminateConnections :: DB -> IO () Source #

Force all connections to the database to close. Can be useful in some testing situations. Called during shutdown as well.

stop :: DB -> IO (Maybe ExitCode) Source #

Stop postgres and clean up the temporary database folder.