persistent 2.14.4.2 → 2.14.4.3
raw patch · 3 files changed
+15/−7 lines, 3 files
Files
- ChangeLog.md +6/−0
- Database/Persist/Sql/Orphan/PersistStore.hs +8/−6
- persistent.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for persistent +## 2.14.4.3++* [#1452](https://github.com/yesodweb/persistent/pull/1452)+ * Implement `repsert` as a special case of `respertMany`. Allows backend+ specific behavior.+ ## 2.14.4.2 * [#1451](https://github.com/yesodweb/persistent/pull/1451)
Database/Persist/Sql/Orphan/PersistStore.hs view
@@ -288,11 +288,7 @@ where go = insrepHelper "INSERT" - repsert key value = do- mExisting <- get key- case mExisting of- Nothing -> insertKey key value- Just _ -> replace key value+ repsert key value = repsertMany [(key, value)] repsertMany [] = return () repsertMany krsDups = do@@ -307,7 +303,13 @@ Just _ -> mkInsertValues r case connRepsertManySql conn of (Just mkSql) -> rawExecute (mkSql ent nr) (concatMap toVals krs)- Nothing -> mapM_ (uncurry repsert) krs+ Nothing -> mapM_ repsert' krs+ where+ repsert' (key, value) = do+ mExisting <- get key+ case mExisting of+ Nothing -> insertKey key value+ Just _ -> replace key value delete k = do conn <- ask
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.14.4.2+version: 2.14.4.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>