-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Start and stop a temporary postgres for testing -- -- This module provides functions creating a temporary postgres instance -- on a random port for testing. -- --
--   result <- start []
--   case result of
--     Left err -> print err
--     Right tempDB -> do
--       -- Do stuff
--       stop tempDB
--   
-- -- The are few different methods for starting postgres which -- provide different methods of dealing with stdout and -- stderr. -- -- The start methods use a config based on the one used by pg_tmp -- (http:/ephemeralpg.org), but can be overriden by different -- values to the first argument of the start functions. -- -- MacOS and Linux are support. Windows is not. -- -- Requires PostgreSQL 9.3+ -- -- WARNING!! Ubuntu's PostgreSQL installation does not put -- initdb on the PATH. We need to add it manually. The -- necessary binaries are in the -- /usr/lib/postgresql/VERSION/bin/ directory, and should be -- added to the PATH -- --
--   echo "export PATH=$PATH:/usr/lib/postgresql/VERSION/bin/" >> /home/ubuntu/.bashrc
--   
@package tmp-postgres @version 0.1.2.0 module Database.Postgres.Temp.Internal getFreePort :: IO Int waitForDB :: String -> IO () data DB DB :: FilePath -> String -> ProcessHandle -> DB -- | Temporary directory where the unix socket, logs and data directory -- live. [mainDir] :: DB -> FilePath -- | PostgreSQL connection string. [connectionString] :: DB -> String -- | The process handle for the postgres process. [pid] :: DB -> ProcessHandle data SocketClass Localhost :: SocketClass Unix :: SocketClass -- | start postgres and use the current processes stdout and stderr start :: [(String, String)] -> IO (Either StartError DB) -- | start postgres and use the current processes stdout and stderr but use -- TCP on localhost instead of a unix socket. startLocalhost :: [(String, String)] -> IO (Either StartError DB) fourth :: (a, b, c, d) -> d procWith :: Handle -> Handle -> String -> [String] -> CreateProcess config :: Maybe FilePath -> String data StartError InitDBFailed :: ExitCode -> StartError CreateDBFailed :: [String] -> ExitCode -> StartError throwIfError :: (ExitCode -> StartError) -> ExitCode -> IO () pidString :: ProcessHandle -> IO String runProcessWith :: Handle -> Handle -> String -> String -> [String] -> IO ExitCode -- | Start postgres and pass in handles for stdout and stderr startWithHandles :: SocketClass -> [(String, String)] -> Handle -> Handle -> IO (Either StartError DB) startWithHandlesAndDir :: SocketClass -> [(String, String)] -> FilePath -> Handle -> Handle -> IO (Either StartError DB) data Event InitDB :: Event WriteConfig :: Event FreePort :: Event StartPostgres :: Event WaitForDB :: Event CreateDB :: Event Finished :: Event rmDirIgnoreErrors :: FilePath -> IO () startWithLogger :: (Event -> IO ()) -> SocketClass -> [(String, String)] -> FilePath -> Handle -> Handle -> IO (Either StartError DB) -- | Start postgres and log it's all stdout to {mainDir}/output.txt -- and {mainDir}/error.txt startAndLogToTmp :: [(String, String)] -> IO (Either StartError DB) -- | Force all connections to the database to close. Can be useful in some -- testing situations. Called during shutdown as well. terminateConnections :: DB -> IO () -- | Stop postgres and clean up the temporary database folder. stop :: DB -> IO ExitCode instance GHC.Classes.Ord Database.Postgres.Temp.Internal.Event instance GHC.Enum.Bounded Database.Postgres.Temp.Internal.Event instance GHC.Enum.Enum Database.Postgres.Temp.Internal.Event instance GHC.Classes.Eq Database.Postgres.Temp.Internal.Event instance GHC.Show.Show Database.Postgres.Temp.Internal.Event instance GHC.Classes.Eq Database.Postgres.Temp.Internal.StartError instance GHC.Show.Show Database.Postgres.Temp.Internal.StartError instance GHC.Generics.Generic Database.Postgres.Temp.Internal.SocketClass instance GHC.Enum.Bounded Database.Postgres.Temp.Internal.SocketClass instance GHC.Enum.Enum Database.Postgres.Temp.Internal.SocketClass instance GHC.Classes.Ord Database.Postgres.Temp.Internal.SocketClass instance GHC.Read.Read Database.Postgres.Temp.Internal.SocketClass instance GHC.Classes.Eq Database.Postgres.Temp.Internal.SocketClass instance GHC.Show.Show Database.Postgres.Temp.Internal.SocketClass instance GHC.Exception.Type.Exception Database.Postgres.Temp.Internal.StartError -- | This module provides functions greating a temporary postgres instance -- on a random port for testing. -- --
--   result <- start []
--   case result of
--     Left err -> print err
--     Right tempDB -> do
--        -- Do stuff
--        stop tempDB
--   
-- -- The are few different methods for starting postgres which -- provide different methods of dealing with stdout and -- stderr. -- -- The start methods use a config based on the one used by pg_tmp, -- but can be overriden by in different values to the first argument of -- the start functions. -- -- WARNING!! Ubuntu's PostgreSQL installation does not put -- initdb on the PATH. We need to add it manually. The -- necessary binaries are in the -- /usr/lib/postgresql/VERSION/bin/ directory, and should be -- added to the PATH -- --
--   echo "export PATH=$PATH:/usr/lib/postgresql/VERSION/bin/" >> /home/ubuntu/.bashrc
--   
module Database.Postgres.Temp data DB DB :: FilePath -> String -> ProcessHandle -> DB -- | Temporary directory where the unix socket, logs and data directory -- live. [mainDir] :: DB -> FilePath -- | PostgreSQL connection string. [connectionString] :: DB -> String -- | The process handle for the postgres process. [pid] :: DB -> ProcessHandle data StartError InitDBFailed :: ExitCode -> StartError CreateDBFailed :: [String] -> ExitCode -> StartError -- | start postgres and use the current processes stdout and stderr start :: [(String, String)] -> IO (Either StartError DB) -- | start postgres and use the current processes stdout and stderr but use -- TCP on localhost instead of a unix socket. startLocalhost :: [(String, String)] -> IO (Either StartError DB) -- | Start postgres and log it's all stdout to {mainDir}/output.txt -- and {mainDir}/error.txt startAndLogToTmp :: [(String, String)] -> IO (Either StartError DB) -- | Start postgres and pass in handles for stdout and stderr startWithHandles :: SocketClass -> [(String, String)] -> Handle -> Handle -> IO (Either StartError DB) -- | Stop postgres and clean up the temporary database folder. stop :: DB -> IO ExitCode data SocketClass Localhost :: SocketClass Unix :: SocketClass