Safe Haskell | None |
---|---|
Language | Haskell2010 |
Testing with an in-memory sqlite database using persistent-sqlite
Synopsis
- runSqlPool :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> m a
- runPersistentTest :: ConnectionPool -> SqlPersistM a -> IO a
- migrationRunner :: MonadIO m => Migration -> ReaderT SqlBackend m ()
Documentation
runSqlPool :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> m a #
Get a connection from the pool, run the given action, and then return the connection to the pool.
This function performs the given action in a transaction. If an exception occurs during the action, then the transaction is rolled back.
Note: This function previously timed out after 2 seconds, but this behavior was buggy and caused more problems than it solved. Since version 2.1.2, it performs no timeout checks.
runPersistentTest :: ConnectionPool -> SqlPersistM a -> IO a Source #
A flipped version of runSqlPool
to run your tests
migrationRunner :: MonadIO m => Migration -> ReaderT SqlBackend m () Source #
Helper function to run a Migration
before/in a test suite that works accross versions of persistent
.
Orphan instances
IsTest (SqlPersistM ()) Source # | |
type Arg1 (SqlPersistM ()) # type Arg2 (SqlPersistM ()) # runTest :: SqlPersistM () -> TestRunSettings -> ((Arg1 (SqlPersistM ()) -> Arg2 (SqlPersistM ()) -> IO ()) -> IO ()) -> IO TestRunResult # | |
IsTest (outerArgs -> SqlPersistM ()) Source # | |
type Arg1 (outerArgs -> SqlPersistM ()) # type Arg2 (outerArgs -> SqlPersistM ()) # runTest :: (outerArgs -> SqlPersistM ()) -> TestRunSettings -> ((Arg1 (outerArgs -> SqlPersistM ()) -> Arg2 (outerArgs -> SqlPersistM ()) -> IO ()) -> IO ()) -> IO TestRunResult # |