hipsql-client-0.0.0.0
Safe HaskellNone
LanguageHaskell2010

Hipsql.Client.Internal

Description

Internal module which implements the hipsql executable. While it is exposed as a library, it is not intended to be used as such.

Synopsis

Disclaimer

Changes to this module will not be reflected in the library's version updates.

Internals

type PsqlM = InputT (ReaderT PsqlEnv IO) Source #

Interpreter monad for our hipsql client.

data ClientIO Source #

Console IO actions performed by the hipsql client. Useful so we can write tests which do not need to interact with the real stdout.

Constructors

ClientIO 

data PsqlEnv Source #

Runtime environment of the hipsql session.

newtype ClientState Source #

Runtime state of the hipsql session.

Constructors

ClientState 

theHipsqlClientVersion :: Version Source #

The compiled hipsql client version.

main :: IO () Source #

Main entry point for the hipsql client executable.

usage :: String Source #

Usage message for hipsql.

abort :: String -> IO a Source #

Aborts with the given message on stderr and exits with a non-zero status.

hipsqlClient :: ClientIO -> Int -> Manager -> IO () Source #

Run the client using the specified configuration.

psql :: PsqlM () Source #

The hipsql interpreter loop.

getServerEval :: ServantClient -> ByteString -> IO ByteString Source #

Default implementation for calling eval against a hipsql-server.

gets :: (ClientState -> a) -> PsqlM a Source #

Access the runtime state with the supplied function.

modify :: (ClientState -> ClientState) -> PsqlM ClientState Source #

Modify the runtime state given the supplied function.

initPsqlEnv :: ServantClient -> IO PsqlEnv Source #

The default, initial PsqlEnv used by the hipsql client.

initPsqlEnv' :: ClientIO -> ServantClient -> IO PsqlEnv Source #

Same as initPsqlEnv but allows for specifying the ClientIO; mostly useful for tests.

defaultClientIO :: ClientIO Source #

The default ClientIO operations

inputStrLn :: String -> PsqlM (Maybe String) Source #

Writes the supplied String to stdout as the shell prompt and reads a line from stdin as a String.

writeLBSLn :: ByteString -> PsqlM () Source #

Writes the supplied ByteString to stdout.