squeal-postgresql-0.9.0.0: Squeal PostgreSQL Library
Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Session

Description

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

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

Instances details
IndexedMonadTransPQ PQ Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

define :: forall (io :: Type -> Type) (db0 :: SchemasType) (db1 :: SchemasType). MonadIO io => Definition db0 db1 -> PQ db0 db1 io () Source #

IndexedMonadTrans PQ Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

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

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

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 # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> PQ db0 db1 m b -> PQ db0 db1 n b #

Migratory (IsoQ Definition) (IsoQ (Indexed PQ IO ())) Source #

pure rewindable migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (IsoQ Definition)) db0 db1 -> IsoQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (IsoQ (Indexed PQ IO ())) (IsoQ (Indexed PQ IO ())) Source #

impure rewindable migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (IsoQ (Indexed PQ IO ()))) db0 db1 -> IsoQ (Indexed PQ IO ()) db0 db1 Source #

MonadBase b m => MonadBase b (PQ schema schema m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

liftBase :: b α -> PQ schema schema m α #

(MonadBaseControl b m, schema0 ~ schema1) => MonadBaseControl b (PQ schema0 schema1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Associated Types

type StM (PQ schema0 schema1 m) a #

Methods

liftBaseWith :: (RunInBase (PQ schema0 schema1 m) b -> b a) -> PQ schema0 schema1 m a #

restoreM :: StM (PQ schema0 schema1 m) a -> PQ schema0 schema1 m a #

(MonadIO io, db0 ~ db, db1 ~ db) => MonadPQ db (PQ db0 db1 io) Source # 
Instance details

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 #

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

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (OpQ Definition)) db0 db1 -> OpQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (OpQ (Indexed PQ IO ())) (OpQ (Indexed PQ IO ())) Source #

impure rewinds

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (OpQ (Indexed PQ IO ()))) db0 db1 -> OpQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (Indexed PQ IO ()) (Indexed PQ IO ()) Source #

impure migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (Indexed PQ IO ())) db0 db1 -> Indexed PQ IO () db0 db1 Source #

db0 ~ db1 => MonadTrans (PQ db0 db1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

lift :: Monad m => m a -> PQ db0 db1 m a #

db0 ~ db1 => MMonad (PQ db0 db1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

embed :: forall (n :: Type -> Type) m b. Monad n => (forall a. m a -> PQ db0 db1 n a) -> PQ db0 db1 m b -> PQ db0 db1 n b #

db0 ~ db1 => MonadTransControl (PQ db0 db1) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Associated Types

type StT (PQ db0 db1) a #

Methods

liftWith :: Monad m => (Run (PQ db0 db1) -> m a) -> PQ db0 db1 m a #

restoreT :: Monad m => m (StT (PQ db0 db1) a) -> PQ db0 db1 m a #

(Monad m, db0 ~ db1) => Monad (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

(>>=) :: PQ db0 db1 m a -> (a -> PQ db0 db1 m b) -> PQ db0 db1 m b #

(>>) :: PQ db0 db1 m a -> PQ db0 db1 m b -> PQ db0 db1 m b #

return :: a -> PQ db0 db1 m a #

Monad m => Functor (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

fmap :: (a -> b) -> PQ db0 db1 m a -> PQ db0 db1 m b #

(<$) :: a -> PQ db0 db1 m b -> PQ db0 db1 m a #

MonadFix m => MonadFix (PQ db db m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

mfix :: (a -> PQ db db m a) -> PQ db db m a #

(Monad m, db0 ~ db1) => MonadFail (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

fail :: String -> PQ db0 db1 m a #

(Monad m, db0 ~ db1) => Applicative (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

pure :: a -> PQ db0 db1 m a #

(<*>) :: PQ db0 db1 m (a -> b) -> PQ db0 db1 m a -> PQ db0 db1 m b #

liftA2 :: (a -> b -> c) -> PQ db0 db1 m a -> PQ db0 db1 m b -> PQ db0 db1 m c #

(*>) :: PQ db0 db1 m a -> PQ db0 db1 m b -> PQ db0 db1 m b #

(<*) :: PQ db0 db1 m a -> PQ db0 db1 m b -> PQ db0 db1 m a #

(Monad m, Alternative m, db0 ~ db1) => Alternative (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

empty :: PQ db0 db1 m a #

(<|>) :: PQ db0 db1 m a -> PQ db0 db1 m a -> PQ db0 db1 m a #

some :: PQ db0 db1 m a -> PQ db0 db1 m [a] #

many :: PQ db0 db1 m a -> PQ db0 db1 m [a] #

(MonadPlus m, db0 ~ db1) => MonadPlus (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

mzero :: PQ db0 db1 m a #

mplus :: PQ db0 db1 m a -> PQ db0 db1 m a -> PQ db0 db1 m a #

(MonadIO m, schema0 ~ schema1) => MonadIO (PQ schema0 schema1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

liftIO :: IO a -> PQ schema0 schema1 m a #

(MonadThrow m, db0 ~ db1) => MonadThrow (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

throwM :: Exception e => e -> PQ db0 db1 m a #

(MonadCatch m, db0 ~ db1) => MonadCatch (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

catch :: Exception e => PQ db0 db1 m a -> (e -> PQ db0 db1 m a) -> PQ db0 db1 m a #

(MonadMask m, db0 ~ db1) => MonadMask (PQ db0 db1 m) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

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 # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

withRunInIO :: ((forall a. PQ db0 db1 m a -> IO a) -> IO b) -> PQ db0 db1 m b #

(Monad m, Semigroup r, db0 ~ db1) => Semigroup (PQ db0 db1 m r) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

(<>) :: PQ db0 db1 m r -> PQ db0 db1 m r -> PQ db0 db1 m r #

sconcat :: NonEmpty (PQ db0 db1 m r) -> PQ db0 db1 m r #

stimes :: Integral b => b -> PQ db0 db1 m r -> PQ db0 db1 m r #

(Monad m, Monoid r, db0 ~ db1) => Monoid (PQ db0 db1 m r) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

mempty :: PQ db0 db1 m r #

mappend :: PQ db0 db1 m r -> PQ db0 db1 m r -> PQ db0 db1 m r #

mconcat :: [PQ db0 db1 m r] -> PQ db0 db1 m r #

type StT (PQ db0 db1) a Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

type StT (PQ db0 db1) a = a
type StM (PQ schema0 schema1 m) x Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

type StM (PQ schema0 schema1 m) x = StM m (K x schema0)

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 #

Do connectdb and finish before and after a computation.