Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Database.Persist.Sqlite.createSqlitePoolWithConfig #1524

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions persistent-sqlite/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 2.13.3.0 (unreleased)

* [#1524](https://github.com/yesodweb/persistent/pull/1524)
* Add Database.Persist.Sqlite.createSqlitePoolWithConfig to create a SQLite
connection pool with a connection string and ConnectionPoolConfig.
Using ConnectionPoolConfig, it is possible to set the connection idle timeout.
* [#1486](https://github.com/yesodweb/persistent/pull/1486)
* Add Database.Sqlite.open' which takes a ByteString
* [#1522](https://github.com/yesodweb/persistent/pull/1522)
Expand Down
10 changes: 10 additions & 0 deletions persistent-sqlite/Database/Persist/Sqlite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Database.Persist.Sqlite
, withSqliteConnInfo
, createSqlitePool
, createSqlitePoolFromInfo
, createSqlitePoolWithConfig
, module Database.Persist.Sql
, SqliteConf (..)
, SqliteConnectionInfo
Expand Down Expand Up @@ -133,6 +134,15 @@ createSqlitePoolFromInfo :: (MonadLoggerIO m, MonadUnliftIO m)
=> SqliteConnectionInfo -> Int -> m (Pool SqlBackend)
createSqlitePoolFromInfo connInfo = createSqlPool $ openWith const connInfo

-- | Create a pool of SQLite connections.
--
-- @since 2.13.4.0
createSqlitePoolWithConfig :: (MonadUnliftIO m, MonadLoggerIO m)
=> Text -- ^ connection string
-> ConnectionPoolConfig -> m (Pool SqlBackend)
createSqlitePoolWithConfig connString =
createSqlPoolWithConfig (openWith const (conStringToInfo connString))

-- | Run the given action with a connection pool.
--
-- Like 'createSqlitePool', this should not be used with @:memory:@.
Expand Down
Loading