about summary refs log tree commit diff
path: root/users/Profpatsch/my-prelude/src/Postgres
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/my-prelude/src/Postgres')
-rw-r--r--users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs b/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs
index bd8ddd12f775..2585f6637c41 100644
--- a/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs
+++ b/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs
@@ -165,6 +165,21 @@ querySingleRow qry params = do
   query qry params >>= ensureSingleRow
 
 -- TODO: implement via fold, so that the result doesn’t have to be realized in memory
+querySingleRowWith ::
+  ( MonadPostgres m,
+    ToRow qParams,
+    Typeable qParams,
+    Typeable a,
+    MonadThrow m
+  ) =>
+  Query ->
+  qParams ->
+  Decoder a ->
+  Transaction m a
+querySingleRowWith qry params decoder = do
+  queryWith qry params decoder >>= ensureSingleRow
+
+-- TODO: implement via fold, so that the result doesn’t have to be realized in memory
 querySingleRowMaybe ::
   ( MonadPostgres m,
     ToRow qParams,