| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Orville.MonadArbiter
Contents
Description
Orville primitives for writing a custom
MonadArbiter instance.
Handlers run in the application monad on Orville's own connection:
import Arbiter.Core qualified as Arb import Arbiter.Orville qualified as ArbO instance Arb.MonadArbiter MyApp where type RegistryOf MyApp = MyRegistry type Handler MyApp job result = job -> MyApp result getSchema = asks appSchema executeQuery = ArbO.orvilleExecuteQuery executeStatement = ArbO.orvilleExecuteStatement withDbTransaction = ArbO.orvilleWithDbTransaction runHandlerWithConnection = ArbO.orvilleRunHandlerWithConnection getListener = asks appListener
The primitives also need a MonadOrville MyApp instance.
Write a handler's own signature as JobHandler MyApp MyPayload MyResult, which is
Handler at that queue's job and declared result types.
Synopsis
- orvilleExecuteQuery :: MonadOrville m => Query a -> m [a]
- orvilleExecuteStatement :: MonadOrville m => Query a -> m Int64
- orvilleWithDbTransaction :: MonadOrville m => m a -> m a
- orvilleRunHandlerWithConnection :: forall {k} job m (result :: k). (job -> m result) -> job -> m result
MonadArbiter implementation
orvilleExecuteQuery :: MonadOrville m => Query a -> m [a]Source #
Run a query, decoding rows.
orvilleExecuteStatement :: MonadOrville m => Query a -> m Int64Source #
Run a statement, returning rows affected.
orvilleWithDbTransaction :: MonadOrville m => m a -> m aSource #
Transaction bracket. Nests via savepoints.
orvilleRunHandlerWithConnection :: forall {k} job m (result :: k). (job -> m result) -> job -> m resultSource #
Run a handler. Orville manages its own connection.