packages feed

opaleye-trans 0.3.1 → 0.3.2

raw patch · 3 files changed

+43/−9 lines, 3 filesdep ~product-profunctorsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: product-profunctors

API changes (from Hackage documentation)

+ Opaleye.Trans: update :: Table w r -> (r -> w) -> (r -> Column PGBool) -> Transaction Int64
+ Opaleye.Trans: updateReturning :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction [haskells]
+ Opaleye.Trans: updateReturningFirst :: Default QueryRunner returned haskells => Table w r -> (r -> w) -> (r -> Column PGBool) -> (r -> returned) -> Transaction (Maybe haskells)

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2015, Matthew Wraith+Copyright (c) 2015, Bitnomial, Inc  All rights reserved. @@ -13,7 +13,7 @@       disclaimer in the documentation and/or other materials provided       with the distribution. -    * Neither the name of Matthew Wraith nor the names of other+    * Neither the name of Bitnomial, Inc nor the names of other       contributors may be used to endorse or promote products derived       from this software without specific prior written permission. 
opaleye-trans.cabal view
@@ -1,13 +1,13 @@ name:                opaleye-trans-version:             0.3.1+version:             0.3.2 synopsis:            A monad transformer for Opaleye description:         A monad transformer for Opaleye-homepage:            https://github.com/tomjaguarpaw/haskell-opaleye+homepage:            https://github.com/WraithM/opaleye-trans license:             BSD3 license-file:        LICENSE author:              Matthew Wraith maintainer:          wraithm@gmail.com-copyright:           (c) 2015 Matthew Wraith+copyright:           (c) 2015 Bitnomial, Inc category:            Database build-type:          Simple cabal-version:       >=1.10@@ -28,7 +28,7 @@     transformers-base   >=0.4 && <0.5,     opaleye             >=0.4 && <0.5,     postgresql-simple   >=0.4 && <0.6,-    product-profunctors >=0.6 && <0.7+    product-profunctors >=0.6 && <0.8  executable opaleye-rosetree   hs-source-dirs:      examples/v1@@ -38,7 +38,7 @@     base                >=4.8 && <4.9,     opaleye             >=0.4 && <0.5,     postgresql-simple   >=0.4 && <0.6,-    product-profunctors >=0.6 && <0.7,+    product-profunctors >=0.6 && <0.8,     opaleye-trans  executable opaleye-rosetree2@@ -49,5 +49,5 @@     base                >=4.8 && <4.9,     opaleye             >=0.4 && <0.5,     postgresql-simple   >=0.4 && <0.6,-    product-profunctors >=0.6 && <0.7,+    product-profunctors >=0.6 && <0.8,     opaleye-trans
src/Opaleye/Trans.hs view
@@ -25,6 +25,11 @@     , insertReturningFirst     , insertManyReturning +    , -- * Updates+      update+    , updateReturning+    , updateReturningFirst+     , -- * Utilities       withConn @@ -128,7 +133,7 @@   -- | Insert a record into a 'Table' with a return value. Retrieve only the first result.--- Similar to @listToMaybe <$> insertReturning@+-- Similar to @'listToMaybe' '<$>' 'insertReturning'@ insertReturningFirst     :: Default QueryRunner a b     => Table w r@@ -149,3 +154,32 @@     -> OpaleyeT m [[b]] insertManyReturning t ret ws =     transaction (mapM (insertReturning t ret) ws)+++-- | Update items in a 'Table' where the predicate is true.  See 'runUpdate'.+update :: Table w r -> (r -> w) -> (r -> Column PGBool) -> Transaction Int64+update t r2w predicate =  withConnIO (\c -> runUpdate c t r2w predicate)+++-- | Update items in a 'Table' with a return value.  See 'runUpdateReturning'.+updateReturning+    :: Default QueryRunner returned haskells+    => Table w r+    -> (r -> w)+    -> (r -> Column PGBool)+    -> (r -> returned)+    -> Transaction [haskells]+updateReturning table r2w predicate r2returned =+    withConnIO (\c -> runUpdateReturning c table r2w predicate r2returned)+++-- | Update items in a 'Table' with a return value.  Similar to @'listToMaybe' '<$>' 'updateReturning'@.+updateReturningFirst+    :: Default QueryRunner returned haskells+    => Table w r+    -> (r -> w)+    -> (r -> Column PGBool)+    -> (r -> returned)+    -> Transaction (Maybe haskells)+updateReturningFirst table r2w predicate r2returned =+    listToMaybe <$> updateReturning table r2w predicate r2returned