tmp-postgres-1.14.0.1: Start and stop a temporary postgres

Safe HaskellNone
LanguageHaskell2010

Database.Postgres.Temp.Config

Contents

Description

This module provides types and functions for combining partial configs into a complete configs to ultimately make a CompletePlan.

This module has two classes of types.

Types like ProcessConfig that could be used by any library that needs to combine process options.

Finally it has types and functions for creating CompletePlans that use temporary resources. This is used to create the default behavior of startConfig and related functions. |

Synopsis

Documentation

data Config Source #

The high level options for overriding default behavior.

Since: 1.12.0.0

Constructors

Config 

Fields

Instances
Generic Config Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep Config :: Type -> Type #

Methods

from :: Config -> Rep Config x #

to :: Rep Config x -> Config #

Semigroup Config Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid Config Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty Config Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Methods

pretty :: Config -> Doc #

prettyList :: [Config] -> Doc #

type Rep Config Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

prettyPrintConfig :: Config -> String Source #

Display a Config.

Since: 1.12.0.0

Config Lenses

planL :: Lens' Config Plan Source #

Lens for plan.

Since: 1.12.0.0

portL :: Lens' Config (Last (Maybe Int)) Source #

Lens for port.

Since: 1.12.0.0

Plan

data Plan Source #

Describe how to run initdb, createdb and postgres

Since: 1.12.0.0

Constructors

Plan 

Fields

Instances
Generic Plan Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep Plan :: Type -> Type #

Methods

from :: Plan -> Rep Plan x #

to :: Rep Plan x -> Plan #

Semigroup Plan Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Methods

(<>) :: Plan -> Plan -> Plan #

sconcat :: NonEmpty Plan -> Plan #

stimes :: Integral b => b -> Plan -> Plan #

Monoid Plan Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Methods

mempty :: Plan #

mappend :: Plan -> Plan -> Plan #

mconcat :: [Plan] -> Plan #

Pretty Plan Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Methods

pretty :: Plan -> Doc #

prettyList :: [Plan] -> Doc #

type Rep Plan Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Plan lenses

loggerL :: Lens' Plan (Last Logger) Source #

Lens for logger.

Since: 1.12.0.0

PostgresPlan

data PostgresPlan Source #

postgres process config and corresponding client connection Options.

Since: 1.12.0.0

Constructors

PostgresPlan 

Fields

PostgresPlan lenses

ProcessConfig

data ProcessConfig Source #

Process configuration

Since: 1.12.0.0

Constructors

ProcessConfig 

Fields

Instances
Eq ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Show ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Generic ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep ProcessConfig :: Type -> Type #

Semigroup ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep ProcessConfig Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

ProcessConfig Lenses

stdErrL :: Lens' ProcessConfig (Last Handle) Source #

Lens for stdErr

Since: 1.12.0.0

stdInL :: Lens' ProcessConfig (Last Handle) Source #

Lens for stdIn.

Since: 1.12.0.0

stdOutL :: Lens' ProcessConfig (Last Handle) Source #

Lens for stdOut.

Since: 1.12.0.0

EnvironmentVariables

data EnvironmentVariables Source #

The environment variables can be declared to inherit from the running process or they can be specifically added.

Since: 1.12.0.0

Instances
Eq EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Show EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Generic EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep EnvironmentVariables :: Type -> Type #

Semigroup EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep EnvironmentVariables Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep EnvironmentVariables = D1 (MetaData "EnvironmentVariables" "Database.Postgres.Temp.Internal.Config" "tmp-postgres-1.14.0.1-fG3XxSoBTU3GmsPBDQhmh" False) (C1 (MetaCons "EnvironmentVariables" PrefixI True) (S1 (MetaSel (Just "inherit") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Last Bool)) :*: S1 (MetaSel (Just "specific") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map String String))))

EnvironmentVariables Lenses

CommandLineArgs

data CommandLineArgs Source #

A type to help combine command line Args.

Since: 1.12.0.0

Constructors

CommandLineArgs 

Fields

  • keyBased :: Map String (Maybe String)

    Args of the form -h foo, --host=foo and --switch. The key is mappended with value so the key should include the space or equals (as shown in the first two examples respectively). The Dual monoid is used so the last key wins.

  • indexBased :: Map Int String

    Args that appear at the end of the key based Args. The Dual monoid is used so the last key wins.

Instances
Eq CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Show CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Generic CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep CommandLineArgs :: Type -> Type #

Semigroup CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep CommandLineArgs Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep CommandLineArgs = D1 (MetaData "CommandLineArgs" "Database.Postgres.Temp.Internal.Config" "tmp-postgres-1.14.0.1-fG3XxSoBTU3GmsPBDQhmh" False) (C1 (MetaCons "CommandLineArgs" PrefixI True) (S1 (MetaSel (Just "keyBased") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map String (Maybe String))) :*: S1 (MetaSel (Just "indexBased") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Int String))))

CommandLineArgs Lenses

DirectoryType

data DirectoryType Source #

Used to specify a Temporary folder that is automatically cleaned up or a Permanent folder which is not automatically cleaned up.

Since: 1.12.0.0

Constructors

Permanent FilePath

A permanent file that should not be generated.

Temporary

A temporary file that needs to generated.

Instances
Eq DirectoryType Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Ord DirectoryType Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Show DirectoryType Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Semigroup DirectoryType Source #

Takes the last Permanent value.

Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid DirectoryType Source #

Temporary as mempty

Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty DirectoryType Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

SocketClass

data SocketClass Source #

SocketClass is used to specify how postgres should listen for connections The two main options are a IpSocket which takes a hostname or IP address. if not is given the default it "127.0.0.1". Alternatively one can specify UnixSocket for a UNIX domain socket. If a directory is specified the socket will live in that folder. Otherwise a temporary folder will get created for the socket.

Since: 1.12.0.0

Constructors

IpSocket (Last String)

The monoid for combining IP address configuration.

UnixSocket DirectoryType

The monoid for combining UNIX socket configuration.

Instances
Eq SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Ord SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Show SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Generic SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

Associated Types

type Rep SocketClass :: Type -> Type #

Semigroup SocketClass Source #

Last IpSocket wins. UnixSocket DirectoryType as mappended together.

Instance details

Defined in Database.Postgres.Temp.Internal.Config

Monoid SocketClass Source #

Treats UnixSocket mempty as mempty.

Instance details

Defined in Database.Postgres.Temp.Internal.Config

Pretty SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep SocketClass Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Config

type Rep SocketClass = D1 (MetaData "SocketClass" "Database.Postgres.Temp.Internal.Config" "tmp-postgres-1.14.0.1-fG3XxSoBTU3GmsPBDQhmh" False) (C1 (MetaCons "IpSocket" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Last String))) :+: C1 (MetaCons "UnixSocket" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DirectoryType)))

Logger

type Logger = Event -> IO () Source #

A way to log internal Events

Since: 1.12.0.0

Internal events passed to the logger .

data Event Source #

Internal events for debugging

Since: 1.12.0.0

Constructors

StartPlan String

The first event. This useful for debugging what is actual passed to the initdb, createdb and postgres.

StartPostgres

The second event. Postgres is about to get called

WaitForDB

The third event. Postgres started. We are now about to setup a reconnect loop (racing with a process checker)

TryToConnect

The fourth event and (possibly all subsequent events). We are looping trying to successfully connect to the postgres process.

Instances
Eq Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Core

Methods

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

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

Ord Event Source # 
Instance details

Defined in Database.Postgres.Temp.Internal.Core

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

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #