Safe Haskell | None |
---|---|
Language | Haskell2010 |
API for building Selda backends.
- class Monad m => MonadIO m where
- type QueryRunner a = Text -> [Param] -> IO a
- data SeldaBackend = SeldaBackend {
- runStmt :: QueryRunner (Int, [[SqlValue]])
- runStmtWithPK :: QueryRunner Int
- customColType :: Text -> [ColAttr] -> Maybe Text
- defaultKeyword :: Text
- dbIdentifier :: Text
- class MonadIO m => MonadSelda m where
- newtype SeldaT m a = S {}
- type SeldaM = SeldaT IO
- data SeldaError
- data Param where
- data Lit a where
- data SqlValue where
- data ColAttr
- compileColAttr :: ColAttr -> Text
- sqlDateTimeFormat :: String
- sqlDateFormat :: String
- sqlTimeFormat :: String
- runSeldaT :: MonadIO m => SeldaT m a -> SeldaBackend -> m a
Documentation
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 (SeldaT m) # | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (ExceptT 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 (IdentityT * 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) | |
type QueryRunner a = Text -> [Param] -> IO a Source #
A function which executes a query and gives back a list of extensible tuples; one tuple per result row, and one tuple element per column.
data SeldaBackend Source #
A collection of functions making up a Selda backend.
SeldaBackend | |
|
class MonadIO m => MonadSelda m where Source #
Some monad with Selda SQL capabilitites.
seldaBackend :: m SeldaBackend Source #
Get the backend in use by the computation.
invalidateTable :: Table a -> m () Source #
Invalidate the given table as soon as the current transaction finishes. Invalidate the table immediately if no transaction is ongoing.
beginTransaction :: m () Source #
Indicates the start of a new transaction.
Starts bookkeeping to invalidate all tables modified during
the transaction at the next call to endTransaction
.
endTransaction :: Bool -> m () Source #
Indicates the end of the current transaction.
Invalidates all tables that were modified since the last call to
beginTransaction
, unless the transaction was rolled back.
MonadIO m => MonadSelda (SeldaT m) Source # | |
Monad transformer adding Selda SQL capabilities.
MonadTrans SeldaT Source # | |
Monad m => Monad (SeldaT m) Source # | |
Functor m => Functor (SeldaT m) Source # | |
Monad m => Applicative (SeldaT m) Source # | |
MonadIO m => MonadIO (SeldaT m) Source # | |
MonadThrow m => MonadThrow (SeldaT m) Source # | |
MonadCatch m => MonadCatch (SeldaT m) Source # | |
MonadMask m => MonadMask (SeldaT m) Source # | |
MonadIO m => MonadSelda (SeldaT m) Source # | |
data SeldaError Source #
Thrown by any function in SeldaT
if an error occurs.
A parameter to a prepared SQL statement.
An SQL literal.
Some value that is representable in SQL.
Column attributes such as nullability, auto increment, etc. When adding elements, make sure that they are added in the order required by SQL syntax, as this list is only sorted before being pretty-printed.
compileColAttr :: ColAttr -> Text Source #
Compile a column attribute.
sqlDateTimeFormat :: String Source #
Format string used to represent date and time when talking to the database backend.
sqlDateFormat :: String Source #
Format string used to represent date when talking to the database backend.
sqlTimeFormat :: String Source #
Format string used to represent time of day when talking to the database backend.