sqlite-easy 0.2.0.1 → 1.0.0.0
raw patch · 6 files changed
+28/−32 lines, 6 filesdep ~resource-pool
Dependency ranges changed: resource-pool
Files
- LICENSE +1/−1
- changelog.md +7/−3
- sqlite-easy.cabal +4/−15
- src/Database/Sqlite/Easy.hs +6/−6
- src/Database/Sqlite/Easy/Internal.hs +9/−7
- src/Database/Sqlite/Easy/Migrant.hs +1/−0
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2022, Gil Mizrahi+Copyright (c) 2022-2023, Gil Mizrahi All rights reserved.
changelog.md view
@@ -1,6 +1,10 @@+### 1.0.0.0++* Bump resource-pool bounds to >=0.4 && <5.+ ### 0.2.0.1 -- Fix: finalize prepared statements even when errors are encountered+* Fix: finalize prepared statements even when errors are encountered. ### 0.2.0.0 @@ -9,5 +13,5 @@ * Introduce `withPool` and export `liftIO`, `fromString` and `void`. * Depend on `unliftio-core` and `mtl`. * Implement nested transactions via savepoints.- * `asTransaction` renamed to `transaction`- * `cancelTransaction` split to `rollback` and `rollbackAll`+ * `asTransaction` renamed to `transaction`.+ * `cancelTransaction` split to `rollback` and `rollbackAll`.
sqlite-easy.cabal view
@@ -1,14 +1,14 @@ cabal-version: 2.4 name: sqlite-easy-version: 0.2.0.1+version: 1.0.0.0 synopsis: A primitive yet easy to use sqlite library. description: A primitive yet easy to use sqlite library built using sqlite-direct, resource-pool and migrant. author: Gil Mizrahi category: Database stability: Experimental-maintainer: gilmi@posteo.net-copyright: 2022 Gil Mizrahi+maintainer: gil@gilmi.net+copyright: 2022-2023 Gil Mizrahi license: BSD-3-Clause license-file: LICENSE homepage: https://gitlab.com/gilmi/sqlite-easy@@ -16,8 +16,6 @@ extra-source-files: README.md changelog.md--- cbits/sqlite3.c--- cbits/sqlite3.h library exposed-modules:@@ -33,19 +31,10 @@ , mtl , unliftio-core , direct-sqlite- , resource-pool+ , resource-pool >=0.4 && <0.5 , migrant-core default-language: Haskell2010 ghc-options: -Wall-- -- c-sources: cbits/sqlite3.c- -- include-dirs: cbits- -- includes: sqlite3.h- -- install-includes: sqlite3.h- -- cc-options: -fPIC -std=c99-- -- if !os(windows)- -- extra-libraries: pthread test-suite sqlite-easy-test type: exitcode-stdio-1.0
src/Database/Sqlite/Easy.hs view
@@ -243,17 +243,17 @@ > pool <- createSqlitePool connectionString > withPool pool runMigrations > pure $ DB-> { getPost = getPostFromDb pool-> , getPosts = getPostsFromDb pool-> , insertPost = insertPostToDb pool-> , deletePostById = deletePostByIdFromDb pool+> { getPost = withPool pool . getPostFromDb+> , getPosts = withPool pool getPostsFromDb+> , insertPost = withPool pool . insertPostToDb+> , deletePostById = withPool pool . deletePostByIdFromDb > } Where: -> getPostFromDb :: Pool Database -> Id -> IO (Id, Post)+> getPostFromDb :: Id -> SQLite (Id, Post) -> insertPostToDb :: Pool Database -> Post -> IO Id+> insertPostToDb :: Post -> SQLite Id and so on.
src/Database/Sqlite/Easy/Internal.hs view
@@ -1,8 +1,11 @@-{-# LANGUAGE RecordWildCards #-}+{-# language RecordWildCards #-} {-# language DerivingVia #-} {-# language OverloadedStrings #-} {-# language ScopedTypeVariables #-} +-- | The implementation of sqlite-easy.+--+-- This module is unstable and may change at any time. module Database.Sqlite.Easy.Internal where import Database.SQLite3@@ -27,12 +30,11 @@ -- | Create a pool of a sqlite3 db with a specific connection string. createSqlitePool :: ConnectionString -> IO (Pool Database) createSqlitePool (ConnectionString connStr) =- newPool PoolConfig- { createResource = open connStr- , freeResource = close- , poolCacheTTL = 180- , poolMaxResources = 50- }+ newPool $ defaultPoolConfig+ (open connStr)+ close+ 180+ 50 -- | Open a database, run some stuff, close the database. withDb :: ConnectionString -> SQLite a -> IO a
src/Database/Sqlite/Easy/Migrant.hs view
@@ -1,5 +1,6 @@ {-# language OverloadedStrings #-} +-- | Migrations support based on @migrant-core@. module Database.Sqlite.Easy.Migrant ( module Database.Migrant.Driver.Class , migrate