[helpers] safeSendMessage

This is a variant of 'sendMessage' which creates the queue
parent 419fe7d9
Pipeline #6749 failed with stages
in 2 minutes and 26 seconds
...@@ -66,6 +66,7 @@ library ...@@ -66,6 +66,7 @@ library
-- Modules exported by the library. -- Modules exported by the library.
exposed-modules: Database.PGMQ exposed-modules: Database.PGMQ
, Database.PGMQ.Helpers
, Database.PGMQ.Schema , Database.PGMQ.Schema
, Database.PGMQ.Simple , Database.PGMQ.Simple
, Database.PGMQ.Types , Database.PGMQ.Types
...@@ -160,7 +161,8 @@ test-suite test-integration ...@@ -160,7 +161,8 @@ test-suite test-integration
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
other-modules: Test.Integration.PGMQ.Simple other-modules: Test.Integration.PGMQ.Helpers
, Test.Integration.PGMQ.Simple
, Test.Integration.Utils , Test.Integration.Utils
build-depends: base ^>=4.17.2.0 build-depends: base ^>=4.17.2.0
......
...@@ -9,10 +9,12 @@ Portability : POSIX ...@@ -9,10 +9,12 @@ Portability : POSIX
-} -}
module Database.PGMQ module Database.PGMQ
( module Database.PGMQ.Simple ( module Database.PGMQ.Helpers
, module Database.PGMQ.Simple
, module Database.PGMQ.Types ) , module Database.PGMQ.Types )
where where
import Database.PGMQ.Helpers
import Database.PGMQ.Simple import Database.PGMQ.Simple
import Database.PGMQ.Types import Database.PGMQ.Types
...@@ -249,7 +249,8 @@ sendMessage conn queue msg delay = do ...@@ -249,7 +249,8 @@ sendMessage conn queue msg delay = do
[PSQL.Only msgId] <- PSQL.query conn [sql| SELECT pgmq.send(?, ?::jsonb, ?) |] (queue, PSQL.Aeson msg, delay) [PSQL.Only msgId] <- PSQL.query conn [sql| SELECT pgmq.send(?, ?::jsonb, ?) |] (queue, PSQL.Aeson msg, delay)
return msgId return msgId
-- | Sends a batch of messages -- | Sends a batch of messages
-- https://tembo.io/pgmq/api/sql/functions/#send_batch -- https://tembo.io/pgmq/api/sql/functions/#send_batch
sendMessages :: (SerializableMessage a) sendMessages :: (SerializableMessage a)
......
module Main where module Main where
import Test.Integration.PGMQ.Helpers (pgmqHelpersTests)
import Test.Integration.PGMQ.Simple (pgmqSimpleTests) import Test.Integration.PGMQ.Simple (pgmqSimpleTests)
import Test.Tasty import Test.Tasty
import Test.Tasty.Hspec import Test.Tasty.Hspec
...@@ -8,10 +9,12 @@ import Test.Tasty.Hspec ...@@ -8,10 +9,12 @@ import Test.Tasty.Hspec
main :: IO () main :: IO ()
main = do main = do
pgmqHelpersSpec <- testSpec "pgmqHelpersTests" pgmqHelpersTests
pgmqSimpleSpec <- testSpec "pgmqSimpleTests" pgmqSimpleTests pgmqSimpleSpec <- testSpec "pgmqSimpleTests" pgmqSimpleTests
defaultMain $ testGroup "integration tests" defaultMain $ testGroup "integration tests"
[ [
pgmqSimpleSpec pgmqSimpleSpec
, pgmqHelpersSpec
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment