Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal module which implements the hipsql
executable.
While it is exposed as a library, it is not intended to be used
as such.
Synopsis
- type ServantClient = HipsqlRoutes (AsClientT IO)
- type PsqlM = InputT (ReaderT PsqlEnv IO)
- data ClientIO = ClientIO {
- inputStrLn' :: String -> PsqlM (Maybe String)
- writeLBSLn' :: ByteString -> PsqlM ()
- data PsqlEnv = PsqlEnv {
- serverApiVersion :: Version
- state :: IORef ClientState
- io :: ClientIO
- serverEval' :: ByteString -> IO ByteString
- newtype ClientState = ClientState {}
- theHipsqlClientVersion :: Version
- main :: IO ()
- usage :: String
- abort :: String -> IO a
- hipsqlClient :: ClientIO -> Int -> Manager -> IO ()
- psql :: PsqlM ()
- getServerEval :: ServantClient -> ByteString -> IO ByteString
- gets :: (ClientState -> a) -> PsqlM a
- modify :: (ClientState -> ClientState) -> PsqlM ClientState
- initPsqlEnv :: ServantClient -> IO PsqlEnv
- initPsqlEnv' :: ClientIO -> ServantClient -> IO PsqlEnv
- defaultClientIO :: ClientIO
- inputStrLn :: String -> PsqlM (Maybe String)
- writeLBSLn :: ByteString -> PsqlM ()
- serverEval :: ByteString -> PsqlM ByteString
- mkServantClient :: Manager -> Int -> IO ServantClient
Disclaimer
Changes to this module will not be reflected in the library's version updates.
Internals
type ServantClient = HipsqlRoutes (AsClientT IO) 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
.
ClientIO | |
|
Runtime environment of the hipsql
session.
PsqlEnv | |
|
newtype ClientState Source #
Runtime state of the hipsql
session.
theHipsqlClientVersion :: Version Source #
The compiled hipsql
client version.
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.
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
writeLBSLn :: ByteString -> PsqlM () Source #
Writes the supplied ByteString
to stdout.
serverEval :: ByteString -> PsqlM ByteString Source #
mkServantClient :: Manager -> Int -> IO ServantClient Source #