Allow new hasql-transaction to do rollbacks
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user