seakale 0.2.0.0 → 0.2.1.0
raw patch · 3 files changed
+18/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Database.Seakale.Store: save :: forall backend m k l a. (MonadStore backend m, Storable backend k l a, ToRow backend k (EntityID a), ToRow backend l a) => EntityID a -> a -> m ()
Files
- ChangeLog.md +4/−0
- seakale.cabal +2/−2
- src/Database/Seakale/Store.hs +12/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for seakale +## 0.2.1.0 -- 2017-03-10++* Add `save :: ... => EntityID a -> a -> m ()` to Database.Seakale.Store+ ## 0.2.0.0 -- 2017-02-23 * Fix a bug with conditions such as `col = NULL` instead of `col IS NULL`
seakale.cabal view
@@ -1,5 +1,5 @@ name: seakale-version: 0.2.0.0+version: 0.2.1.0 synopsis: Pure SQL layer on top of other libraries description: This library allows you to write pure code doing operations on a SQL databases. It can therefore be tested by mocking the database with the package 'seakale-tests'. To run it of a specific database, you need another package such as 'seakale-postgresql'. license: BSD3@@ -14,7 +14,7 @@ source-repository head type: darcs location: http://darcs.redspline.com/seakale- tag: 0.2.0.0+ tag: 0.2.1.0 library ghc-options: -Wall
src/Database/Seakale/Store.hs view
@@ -29,6 +29,7 @@ , insert , updateMany , update+ , save , UpdateSetter , (=.) , deleteMany@@ -158,6 +159,17 @@ update i setter = do n <- updateMany setter $ EntityID ==. i unless (n == 1) $ throwSeakaleError EntityNotFoundError++save :: forall backend m k l a.+ ( MonadStore backend m, Storable backend k l a+ , ToRow backend k (EntityID a), ToRow backend l a )+ => EntityID a -> a -> m ()+save i val = do+ let setter = UpdateSetter $ \backend ->+ let Relation{..} = (relation backend :: Relation backend k l a)+ row = fmap (fromMaybe "NULL") $ toRow backend val+ in vzip relationColumns row+ update i setter -- | Delete rows matching the given conditions. deleteMany :: forall backend m k l a.