Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Using Squeal in your application will come down to defining
the DB ::
SchemasType
of your database and including PQ DB DB
in your
application's monad transformer stack, giving it an instance of MonadPQ
DB
.
Synopsis
- newtype PQ (db0 :: SchemasType) (db1 :: SchemasType) (m :: Type -> Type) (x :: Type) = PQ {
- unPQ :: K Connection db0 -> m (K x db1)
- runPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m (x, K Connection db1)
- execPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m (K Connection db1)
- evalPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m x
- withConnection :: forall db0 db1 io x. MonadUnliftIO io => ByteString -> PQ db0 db1 io x -> io x
Documentation
newtype PQ (db0 :: SchemasType) (db1 :: SchemasType) (m :: Type -> Type) (x :: Type) Source #
We keep track of the schema via an Atkey indexed state monad transformer,
PQ
.
PQ | |
|
Instances
IndexedMonadTransPQ PQ Source # | |
Defined in Squeal.PostgreSQL.Session | |
IndexedMonadTrans PQ Source # | |
Defined in Squeal.PostgreSQL.Session pqAp :: Monad m => PQ i j m (x -> y) -> PQ j k m x -> PQ i k m y Source # pqJoin :: Monad m => PQ i j m (PQ j k m y) -> PQ i k m y Source # pqBind :: Monad m => (x -> PQ j k m y) -> PQ i j m x -> PQ i k m y Source # pqThen :: Monad m => PQ j k m y -> PQ i j m x -> PQ i k m y Source # pqAndThen :: Monad m => (y -> PQ j k m z) -> (x -> PQ i j m y) -> x -> PQ i k m z Source # | |
Migratory Definition (Indexed PQ IO ()) Source # | pure migrations |
Defined in Squeal.PostgreSQL.Session.Migration runMigrations :: Path (Migration Definition) db0 db1 -> Indexed PQ IO () db0 db1 Source # | |
db0 ~ db1 => MFunctor (PQ db0 db1 :: (Type -> Type) -> Type -> Type) Source # | |
Migratory (IsoQ Definition) (IsoQ (Indexed PQ IO ())) Source # | pure rewindable migrations |
Defined in Squeal.PostgreSQL.Session.Migration | |
Migratory (IsoQ (Indexed PQ IO ())) (IsoQ (Indexed PQ IO ())) Source # | impure rewindable migrations |
MonadBase b m => MonadBase b (PQ schema schema m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(MonadBaseControl b m, schema0 ~ schema1) => MonadBaseControl b (PQ schema0 schema1 m) Source # | |
(MonadIO io, db0 ~ db, db1 ~ db) => MonadPQ db (PQ db0 db1 io) Source # | |
Defined in Squeal.PostgreSQL.Session executeParams :: Statement db x y -> x -> PQ db0 db1 io (Result y) Source # executeParams_ :: Statement db x () -> x -> PQ db0 db1 io () Source # execute :: Statement db () y -> PQ db0 db1 io (Result y) Source # execute_ :: Statement db () () -> PQ db0 db1 io () Source # executePrepared :: Traversable list => Statement db x y -> list x -> PQ db0 db1 io (list (Result y)) Source # executePrepared_ :: Foldable list => Statement db x () -> list x -> PQ db0 db1 io () Source # | |
Migratory (OpQ Definition) (OpQ (Indexed PQ IO ())) Source # | pure rewinds |
Defined in Squeal.PostgreSQL.Session.Migration | |
Migratory (OpQ (Indexed PQ IO ())) (OpQ (Indexed PQ IO ())) Source # | impure rewinds |
Migratory (Indexed PQ IO ()) (Indexed PQ IO ()) Source # | impure migrations |
db0 ~ db1 => MonadTrans (PQ db0 db1) Source # | |
Defined in Squeal.PostgreSQL.Session | |
db0 ~ db1 => MMonad (PQ db0 db1) Source # | |
db0 ~ db1 => MonadTransControl (PQ db0 db1) Source # | |
(Monad m, db0 ~ db1) => Monad (PQ db0 db1 m) Source # | |
Monad m => Functor (PQ db0 db1 m) Source # | |
(Monad m, db0 ~ db1) => MonadFail (PQ db0 db1 m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(Monad m, db0 ~ db1) => Applicative (PQ db0 db1 m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(MonadIO m, schema0 ~ schema1) => MonadIO (PQ schema0 schema1 m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(MonadThrow m, db0 ~ db1) => MonadThrow (PQ db0 db1 m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(MonadCatch m, db0 ~ db1) => MonadCatch (PQ db0 db1 m) Source # | |
(MonadMask m, db0 ~ db1) => MonadMask (PQ db0 db1 m) Source # | |
Defined in Squeal.PostgreSQL.Session mask :: ((forall a. PQ db0 db1 m a -> PQ db0 db1 m a) -> PQ db0 db1 m b) -> PQ db0 db1 m b # uninterruptibleMask :: ((forall a. PQ db0 db1 m a -> PQ db0 db1 m a) -> PQ db0 db1 m b) -> PQ db0 db1 m b # generalBracket :: PQ db0 db1 m a -> (a -> ExitCase b -> PQ db0 db1 m c) -> (a -> PQ db0 db1 m b) -> PQ db0 db1 m (b, c) # | |
(MonadUnliftIO m, db0 ~ db1) => MonadUnliftIO (PQ db0 db1 m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(Monad m, Semigroup r, db0 ~ db1) => Semigroup (PQ db0 db1 m r) Source # | |
(Monad m, Monoid r, db0 ~ db1) => Monoid (PQ db0 db1 m r) Source # | |
type StT (PQ db0 db1) a Source # | |
Defined in Squeal.PostgreSQL.Session | |
type StM (PQ schema0 schema1 m) x Source # | |
Defined in Squeal.PostgreSQL.Session |
runPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m (x, K Connection db1) Source #
Run a PQ
and keep the result and the Connection
.
execPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m (K Connection db1) Source #
Execute a PQ
and discard the result but keep the Connection
.
evalPQ :: Functor m => PQ db0 db1 m x -> K Connection db0 -> m x Source #
Evaluate a PQ
and discard the Connection
but keep the result.
withConnection :: forall db0 db1 io x. MonadUnliftIO io => ByteString -> PQ db0 db1 io x -> io x Source #