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. (MonadIO io, MonadMask 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 define :: forall (io :: Type -> Type) (db0 :: SchemasType) (db1 :: SchemasType). MonadIO io => Definition db0 db1 -> PQ db0 db1 io () Source # | |
IndexedMonadTrans PQ Source # | |
Defined in Squeal.PostgreSQL.Session pqAp :: forall (m :: Type -> Type) (i :: k) (j :: k) x y (k :: k). Monad m => PQ i j m (x -> y) -> PQ j k m x -> PQ i k m y Source # pqJoin :: forall (m :: Type -> Type) (i :: k) (j :: k) (k :: k) y. Monad m => PQ i j m (PQ j k m y) -> PQ i k m y Source # pqBind :: forall (m :: Type -> Type) x (j :: k) (k :: k) y (i :: k). Monad m => (x -> PQ j k m y) -> PQ i j m x -> PQ i k m y Source # pqThen :: forall (m :: Type -> Type) (j :: k) (k :: k) y (i :: k) x. Monad m => PQ j k m y -> PQ i j m x -> PQ i k m y Source # pqAndThen :: forall (m :: Type -> Type) y (j :: k) (k :: k) z x (i :: k). 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 :: forall (db0 :: k) (db1 :: k). 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 # prepare :: Statement db x y -> PQ db0 db1 io (Prepared (PQ db0 db1 io) x (Result y)) Source # prepare_ :: Statement db x () -> PQ db0 db1 io (Prepared (PQ db0 db1 io) x ()) 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 # | |
MonadFix m => MonadFix (PQ db db m) Source # | |
Defined in Squeal.PostgreSQL.Session | |
(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 | |
(Monad m, Alternative m, db0 ~ db1) => Alternative (PQ db0 db1 m) Source # | |
(MonadPlus m, db0 ~ db1) => MonadPlus (PQ db0 db1 m) Source # | |
(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. (MonadIO io, MonadMask io) => ByteString -> PQ db0 db1 io x -> io x Source #