Allow new hasql-transaction to do rollbacks

This commit is contained in:
Joe Nelson
2016-02-25 20:13:03 -08:00
parent de772b9246
commit f28b03f419
3 changed files with 3 additions and 8 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ executable postgrest
, errors
, hasql >= 0.19.3.3 && < 0.20
, hasql-pool >= 0.4 && < 0.5
, hasql-transaction >= 0.4 && < 0.5
, hasql-transaction >= 0.4.3 && < 0.5
, http-types
, interpolatedstring-perl6
, jwt
+1 -6
View File
@@ -14,7 +14,6 @@ import PostgREST.Middleware
import PostgREST.Types (DbStructure)
import Control.Monad
import Control.Monad.Error.Class (catchError, throwError)
import Data.Monoid ((<>))
import Data.String.Conversions (cs)
import Data.Time.Clock.POSIX (getPOSIXTime)
@@ -96,9 +95,5 @@ postgrest conf dbStructure pool =
let handleReq = runWithClaims conf time (app dbStructure conf body) req
resp <- either pgErrResponse id <$> P.use pool
(rollbackOnError $ HT.run handleReq HT.ReadCommitted HT.Write)
(HT.run handleReq HT.ReadCommitted HT.Write)
respond resp
where
rollbackOnError :: H.Session a -> H.Session a
rollbackOnError = (`catchError` ((H.sql "rollback;" >>) . throwError))
+1 -1
View File
@@ -4,7 +4,7 @@ extra-deps:
- bytestring-tree-builder-0.2.5
- hasql-0.19.8
- hasql-pool-0.4
- hasql-transaction-0.4.2
- hasql-transaction-0.4.3
- packdeps-0.4.2.1
- postgresql-error-codes-1
- postgresql-binary-0.8.1