Safe Haskell | None |
---|---|
Language | Haskell2010 |
Postgres Connection MonadTx
This module contains MonadTx
and related combinators.
MonadTx
, a class which abstracts the QErr
in TxE
via MonadError
.
The combinators are used for running, tracing, or otherwise perform database related tasks. Please consult the individual documentation for more information.
Synopsis
- class MonadError QErr m => MonadTx m where
- runTx :: (MonadIO m, MonadBaseControl IO m) => PGExecCtx -> TxAccess -> TxET QErr m a -> ExceptT QErr m a
- runTxWithCtx :: (MonadIO m, MonadBaseControl IO m, MonadError QErr m, MonadTrace m, UserInfoM m) => PGExecCtx -> TxAccess -> TxET QErr m a -> m a
- runQueryTx :: (MonadIO m, MonadError QErr m) => PGExecCtx -> TxET QErr IO a -> m a
- setHeadersTx :: MonadIO m => SessionVariables -> TxET QErr m ()
- sessionInfoJsonExp :: SessionVariables -> SQLExp
- withUserInfo :: MonadIO m => UserInfo -> TxET QErr m a -> TxET QErr m a
- setTraceContextInTx :: MonadIO m => TraceContext -> TxET QErr m ()
- withTraceContext :: MonadIO m => TraceContext -> TxET QErr m a -> TxET QErr m a
- checkDbConnection :: MonadTx m => m ()
- doesSchemaExist :: MonadTx m => SchemaName -> m Bool
- doesTableExist :: MonadTx m => SchemaName -> TableName -> m Bool
- isExtensionAvailable :: MonadTx m => Text -> m Bool
- enablePgcryptoExtension :: forall m. MonadTx m => ExtensionsSchema -> m ()
- dropHdbCatalogSchema :: MonadTx m => m ()
Documentation
class MonadError QErr m => MonadTx m where Source #
Instances
MonadTx m => MonadTx (TraceT m) Source # | |
MonadTx m => MonadTx (SourceT m) Source # | |
MonadTx m => MonadTx (MetadataT m) Source # | |
MonadTx m => MonadTx (ReaderT s m) Source # | |
MonadTx m => MonadTx (StateT s m) Source # | |
(Monoid w, MonadTx m) => MonadTx (WriterT w m) Source # | |
MonadIO m => MonadTx (TxET QErr m) Source # | |
MonadTx m => MonadTx (ValidateT e m) Source # | |
Defined in Hasura.Backends.Postgres.Connection.MonadTx | |
MonadTx m => MonadTx (TableCacheRT b m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache liftTx :: TxE QErr a -> TableCacheRT b m a Source # | |
MonadTx m => MonadTx (TableCoreCacheRT b m) Source # | |
Defined in Hasura.RQL.Types.SchemaCache liftTx :: TxE QErr a -> TableCoreCacheRT b m a Source # |
runTx :: (MonadIO m, MonadBaseControl IO m) => PGExecCtx -> TxAccess -> TxET QErr m a -> ExceptT QErr m a Source #
Executes the given query in a transaction of the specified mode, within the provided PGExecCtx.
runTxWithCtx :: (MonadIO m, MonadBaseControl IO m, MonadError QErr m, MonadTrace m, UserInfoM m) => PGExecCtx -> TxAccess -> TxET QErr m a -> m a Source #
runQueryTx :: (MonadIO m, MonadError QErr m) => PGExecCtx -> TxET QErr IO a -> m a Source #
This runs the given set of statements (Tx) without wrapping them in BEGIN and COMMIT. This should only be used for running a single statement query!
setHeadersTx :: MonadIO m => SessionVariables -> TxET QErr m () Source #
setTraceContextInTx :: MonadIO m => TraceContext -> TxET QErr m () Source #
withTraceContext :: MonadIO m => TraceContext -> TxET QErr m a -> TxET QErr m a Source #
Inject the trace context as a transaction-local variable, so that it can be picked up by any triggers (including event triggers).
checkDbConnection :: MonadTx m => m () Source #
doesSchemaExist :: MonadTx m => SchemaName -> m Bool Source #
doesTableExist :: MonadTx m => SchemaName -> TableName -> m Bool Source #
isExtensionAvailable :: MonadTx m => Text -> m Bool Source #
enablePgcryptoExtension :: forall m. MonadTx m => ExtensionsSchema -> m () Source #
dropHdbCatalogSchema :: MonadTx m => m () Source #
Orphan instances
MonadTrace m => MonadTrace (TxET e m) Source # | |
trace :: Text -> TxET e m a -> TxET e m a Source # currentContext :: TxET e m TraceContext Source # currentReporter :: TxET e m Reporter Source # attachMetadata :: TracingMetadata -> TxET e m () Source # |