opaleye 0.5.1.0 → 0.5.1.1
raw patch · 2 files changed
+48/−10 lines, 2 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- opaleye.cabal +1/−1
- src/Opaleye/Manipulation.hs +47/−9
opaleye.cabal view
@@ -1,6 +1,6 @@ name: opaleye copyright: Copyright (c) 2014-2016 Purely Agile Limited-version: 0.5.1.0+version: 0.5.1.1 synopsis: An SQL-generating DSL targeting PostgreSQL description: An SQL-generating DSL targeting PostgreSQL. Allows Postgres queries to be written within Haskell in a
src/Opaleye/Manipulation.hs view
@@ -46,51 +46,89 @@ import Data.String (fromString) import qualified Data.List.NonEmpty as NEL --- | Returns the number of rows inserted+-- | Insert rows into a table runInsertMany :: PGS.Connection+ -- ^ -> T.Table columns columns'+ -- ^ Table to insert into -> [columns]+ -- ^ Rows to insert -> IO Int64+ -- ^ Number of rows inserted runInsertMany conn table columns = case NEL.nonEmpty columns of -- Inserting the empty list is just the same as returning 0 Nothing -> return 0 Just columns' -> (PGS.execute_ conn . fromString .: arrangeInsertManySql) table columns' --- | @runInsertManyReturning@'s use of the 'D.Default' typeclass means that the+-- | Insert rows into a table and return a function of the inserted rows+--+-- @runInsertManyReturning@'s use of the 'D.Default' typeclass means that the -- compiler will have trouble inferring types. It is strongly -- recommended that you provide full type signatures when using -- @runInsertManyReturning@. runInsertManyReturning :: (D.Default RQ.QueryRunner returned haskells) => PGS.Connection+ -- ^ -> T.Table columnsW columnsR+ -- ^ Table to insert into -> [columnsW]+ -- ^ Rows to insert -> (columnsR -> returned)+ -- ^ Function @f@ to apply to the inserted rows -> IO [haskells]+ -- ^ Returned rows after @f@ has been applied runInsertManyReturning = runInsertManyReturningExplicit D.def --- | Where the predicate is true, update rows using the supplied--- function.-runUpdate :: PGS.Connection -> T.Table columnsW columnsR- -> (columnsR -> columnsW) -> (columnsR -> Column PGBool)+-- | Update rows in a table+runUpdate :: PGS.Connection+ -> T.Table columnsW columnsR+ -- ^ Table to update+ -> (columnsR -> columnsW)+ -- ^ Update function to apply to chosen rows+ -> (columnsR -> Column PGBool)+ -- ^ Predicate function @f@ to choose which rows to update.+ -- 'runUpdate' will update rows for which @f@ returns @TRUE@+ -- and leave unchanged rows for which @f@ returns @FALSE@. -> IO Int64+ -- ^ The number of updated rows runUpdate conn = PGS.execute_ conn . fromString .:. arrangeUpdateSql --- | @runUpdateReturning@'s use of the 'D.Default' typeclass means++-- | Update rows in a table and return a function of the updated rows+--+-- @runUpdateReturning@'s use of the 'D.Default' typeclass means -- that the compiler will have trouble inferring types. It is -- strongly recommended that you provide full type signatures when -- using @runInsertReturning@. runUpdateReturning :: (D.Default RQ.QueryRunner returned haskells) => PGS.Connection+ -- ^ -> T.Table columnsW columnsR+ -- ^ Table to update -> (columnsR -> columnsW)+ -- ^ Update function to apply to chosen rows -> (columnsR -> Column PGBool)+ -- ^ Predicate function @f@ to choose which rows to+ -- update. 'runUpdate' will update rows for which+ -- @f@ returns @TRUE@ and leave unchanged rows for+ -- which @f@ returns @FALSE@. -> (columnsR -> returned)+ -- ^ Functon @g@ to apply to the updated rows -> IO [haskells]+ -- ^ Returned rows after @g@ has been applied runUpdateReturning = runUpdateReturningExplicit D.def --- | Delete rows where the predicate is true.-runDelete :: PGS.Connection -> T.Table a columnsR -> (columnsR -> Column PGBool)+-- | Delete rows from a table+runDelete :: PGS.Connection+ -- ^+ -> T.Table a columnsR+ -- ^ Table to delete rows from+ -> (columnsR -> Column PGBool)+ -- ^ Predicate function @f@ to choose which rows to delete.+ -- 'runDelete' will delete rows for which @f@ returns @TRUE@+ -- and leave unchanged rows for which @f@ returns @FALSE@. -> IO Int64+ -- ^ The number of deleted rows runDelete conn = PGS.execute_ conn . fromString .: arrangeDeleteSql -- | You probably don't need this, but can just use