Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | [email protected] |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Squeal.PostgreSQL.Session
Description
Using Squeal in your application will come down to defining
the db
of your database and including PQ db db
in your
application's monad transformer stack, giving it an instance of MonadPQ
.
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
.
Constructors
PQ | |
Fields
|
Instances
IndexedMonadTransPQ PQ Source # | |
Defined in Squeal.PostgreSQL.Session | |
IndexedMonadTrans PQ Source # | |
Defined in Squeal.PostgreSQL.Session Methods 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 Methods 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 |
(MonadIO io, db0 ~ db, db1 ~ db) => MonadPQ db (PQ db0 db1 io) Source # | |
Defined in Squeal.PostgreSQL.Session Methods 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 # | |
(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 | |
(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 # | |
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 #