Safe Haskell | None |
---|---|
Language | Haskell2010 |
SQLite3 backend for Selda.
Synopsis
- data SQLite
- withSQLite :: (MonadIO m, MonadMask m) => FilePath -> SeldaT SQLite m a -> m a
- sqliteOpen :: (MonadIO m, MonadMask m) => FilePath -> m (SeldaConnection SQLite)
- seldaClose :: MonadIO m => SeldaConnection b -> m ()
- sqliteBackend :: Database -> SeldaBackend SQLite
Documentation
withSQLite :: (MonadIO m, MonadMask m) => FilePath -> SeldaT SQLite m a -> m a Source #
Perform the given computation over an SQLite database. The database is guaranteed to be closed when the computation terminates.
sqliteOpen :: (MonadIO m, MonadMask m) => FilePath -> m (SeldaConnection SQLite) Source #
Open a new connection to an SQLite database.
The connection is reusable across calls to runSeldaT
, and must be
explicitly closed using seldaClose
when no longer needed.
seldaClose :: MonadIO m => SeldaConnection b -> m () #
Close a reusable Selda connection.
Closing a connection while in use is undefined.
Passing a closed connection to runSeldaT
results in a SeldaError
being thrown. Closing a connection more than once is a no-op.
sqliteBackend :: Database -> SeldaBackend SQLite Source #
Create a Selda backend using an already open database handle. This is useful for situations where you want to use some SQLite-specific functionality alongside Selda.
Note that manipulating the underlying database handle directly voids any and all safety guarantees made by the Selda API. Caching functionality in particular WILL break. Proceed with extreme caution.