Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype OpaleyeT m a = OpaleyeT {
- unOpaleyeT :: ReaderT Connection m a
- runOpaleyeT :: Connection -> OpaleyeT m a -> m a
- data Transaction a
- transaction :: MonadIO m => Transaction a -> OpaleyeT m a
- run :: MonadIO m => Transaction a -> OpaleyeT m a
- query :: Default QueryRunner a b => Query a -> Transaction [b]
- queryFirst :: Default QueryRunner a b => Query a -> Transaction (Maybe b)
- insert :: Table w r -> w -> Transaction Int64
- insertMany :: Table w r -> [w] -> Transaction Int64
- insertReturning :: Default QueryRunner a b => Table w r -> (r -> a) -> w -> Transaction [b]
- insertReturningFirst :: Default QueryRunner a b => Table w r -> (r -> a) -> w -> Transaction (Maybe b)
- insertManyReturning :: (MonadIO m, Default QueryRunner a b) => Table w r -> (r -> a) -> [w] -> OpaleyeT m [[b]]
- update :: Table w r -> (r -> w) -> (r -> Column PGBool) -> Transaction Int64
- updateReturning :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction [haskells]
- updateReturningFirst :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction (Maybe haskells)
- withConn :: MonadIO m => (Connection -> IO a) -> OpaleyeT m a
- liftBase :: MonadBase b m => forall α. b α -> m α
- class (Applicative b, Applicative m, Monad b, Monad m) => MonadBase b m | m -> b where
- liftBase :: b α -> m α
- liftIO :: MonadIO m => forall a. IO a -> m a
- class Monad m => MonadIO m where
- ask :: MonadReader r m => m r
- data Int64 :: *
Documentation
The Opaleye
monad transformer
OpaleyeT | |
|
MonadTrans OpaleyeT Source # | |
Monad m => MonadReader Connection (OpaleyeT m) Source # | |
MonadBase b m => MonadBase b (OpaleyeT m) Source # | |
Monad m => Monad (OpaleyeT m) Source # | |
Functor m => Functor (OpaleyeT m) Source # | |
Applicative m => Applicative (OpaleyeT m) Source # | |
MonadIO m => MonadIO (OpaleyeT m) Source # | |
runOpaleyeT :: Connection -> OpaleyeT m a -> m a Source #
Given a Connection
, run an OpaleyeT
Transactions
data Transaction a Source #
transaction :: MonadIO m => Transaction a -> OpaleyeT m a Source #
Run a postgresql transaction in the OpaleyeT
monad
run :: MonadIO m => Transaction a -> OpaleyeT m a Source #
Execute a query without a literal transaction
Queries
query :: Default QueryRunner a b => Query a -> Transaction [b] Source #
queryFirst :: Default QueryRunner a b => Query a -> Transaction (Maybe b) Source #
Inserts
insertMany :: Table w r -> [w] -> Transaction Int64 Source #
Insert many records into a Table
. See runInsertMany
.
insertReturning :: Default QueryRunner a b => Table w r -> (r -> a) -> w -> Transaction [b] Source #
Insert a record into a Table
with a return value. See runInsertReturning
.
insertReturningFirst :: Default QueryRunner a b => Table w r -> (r -> a) -> w -> Transaction (Maybe b) Source #
Insert a record into a Table
with a return value. Retrieve only the first result.
Similar to listToMaybe
<$>
insertReturning
insertManyReturning :: (MonadIO m, Default QueryRunner a b) => Table w r -> (r -> a) -> [w] -> OpaleyeT m [[b]] Source #
Insert many records into a Table
with a return value for each record.
Maybe not worth defining. This almost certainly does the wrong thing.
Updates
updateReturning :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction [haskells] Source #
Update items in a Table
with a return value. See runUpdateReturning
.
updateReturningFirst :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction (Maybe haskells) Source #
Update items in a Table
with a return value. Similar to
.listToMaybe
<$>
updateReturning
Utilities
Reexports
class (Applicative b, Applicative m, Monad b, Monad m) => MonadBase b m | m -> b where #
MonadBase [] [] | |
MonadBase Maybe Maybe | |
MonadBase IO IO | |
MonadBase Identity Identity | |
MonadBase STM STM | |
MonadBase b m => MonadBase b (MaybeT m) | |
MonadBase b m => MonadBase b (ListT m) | |
MonadBase b m => MonadBase b (OpaleyeT m) # | |
(Monoid w, MonadBase b m) => MonadBase b (WriterT w m) | |
(Monoid w, MonadBase b m) => MonadBase b (WriterT w m) | |
MonadBase b m => MonadBase b (StateT s m) | |
MonadBase b m => MonadBase b (StateT s m) | |
MonadBase b m => MonadBase b (IdentityT * m) | |
MonadBase b m => MonadBase b (ExceptT e m) | |
(Error e, MonadBase b m) => MonadBase b (ErrorT e m) | |
MonadBase b m => MonadBase b (ReaderT * r m) | |
MonadBase b m => MonadBase b (ContT * r m) | |
(Monoid w, MonadBase b m) => MonadBase b (RWST r w s m) | |
(Monoid w, MonadBase b m) => MonadBase b (RWST r w s m) | |
MonadBase ((->) r) ((->) r) | |
MonadBase (Either e) (Either e) | |
MonadBase (ST s) (ST s) | |
MonadBase (ST s) (ST s) | |
class Monad m => MonadIO m where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
MonadIO IO | |
MonadIO m => MonadIO (ListT m) | |
MonadIO m => MonadIO (MaybeT m) | |
MonadIO m => MonadIO (OpaleyeT m) # | |
MonadIO m => MonadIO (IdentityT * m) | |
MonadIO m => MonadIO (ExceptT e m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (StateT s m) | |
MonadIO m => MonadIO (StateT s m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
MonadIO m => MonadIO (ContT * r m) | |
MonadIO m => MonadIO (ReaderT * r m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
(Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
ask :: MonadReader r m => m r #
Retrieves the monad environment.
64-bit signed integer type