pgmq-hasql 0.1.2.0 → 0.1.3.0
raw patch · 5 files changed
+42/−35 lines, 5 filesdep ~pgmq-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: pgmq-core
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- pgmq-hasql.cabal +3/−3
- src/Pgmq/Hasql/Statements/Message.hs +24/−24
- src/Pgmq/Hasql/Statements/QueueManagement.hs +5/−5
- src/Pgmq/Hasql/Statements/QueueObservability.hs +3/−3
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Revision history for pgmq-hasql +## 0.1.3.0 -- 2026-03-12++### Other Changes++* Update documentation URLs from tembo.io to pgmq.github.io+* Update repository homepage URL to shinzui/pgmq-hs+ ## 0.1.2.0 -- 2026-03-03 * Version bump only (no changes)
pgmq-hasql.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name: pgmq-hasql-version: 0.1.2.0+version: 0.1.3.0 synopsis: Hasql-based client for PGMQ (PostgreSQL Message Queue) description: A Haskell client library for PGMQ (PostgreSQL Message Queue) built@@ -9,7 +9,7 @@ pgmq 1.5.0 through 1.11.0 features including message headers, conditional reads, notifications, round-robin FIFO, and topic routing. -homepage: https://github.com/topagentnetwork/pgmq-hs+homepage: https://github.com/shinzui/pgmq-hs license: MIT license-file: LICENSE author: Nadeem Bitar@@ -57,7 +57,7 @@ , hasql ^>=1.10 , hasql-transaction ^>=1.2 , lens ^>=5.3- , pgmq-core >=0.1.2 && <0.2+ , pgmq-core >=0.1.3 && <0.2 , template-haskell >=2.20 && <3 , text ^>=2.1 , time ^>=1.14
src/Pgmq/Hasql/Statements/Message.hs view
@@ -97,7 +97,7 @@ ) import Pgmq.Types (Message, MessageId, QueueName, TopicSendResult) --- https://tembo.io/pgmq/api/sql/functions/#send+-- https://pgmq.github.io/pgmq/api/sql/functions/#send -- Note: coalesce handles null delay to ensure correct function overload resolution sendMessage :: Statement SendMessage MessageId sendMessage = preparable sql sendMessageEncoder decoder@@ -105,14 +105,14 @@ sql = "select * from pgmq.send($1, $2, coalesce($3, 0))" decoder = D.singleRow messageIdDecoder --- https://tembo.io/pgmq/api/sql/functions/#send+-- https://pgmq.github.io/pgmq/api/sql/functions/#send sendMessageForLater :: Statement SendMessageForLater MessageId sendMessageForLater = preparable sql sendMessageForLaterEncoder decoder where sql = "select * from pgmq.send($1, $2, $3)" decoder = D.singleRow messageIdDecoder --- | https://tembo.io/pgmq/api/sql/functions/#send_batch+-- | https://pgmq.github.io/pgmq/api/sql/functions/#send_batch -- Note: coalesce handles null delay to ensure correct function overload resolution batchSendMessage :: Statement BatchSendMessage [MessageId] batchSendMessage = preparable sql batchSendMessageEncoder decoder@@ -120,7 +120,7 @@ sql = "select * from pgmq.send_batch($1, $2, coalesce($3, 0))" decoder = D.rowList messageIdDecoder --- | https://tembo.io/pgmq/api/sql/functions/#send_batch+-- | https://pgmq.github.io/pgmq/api/sql/functions/#send_batch batchSendMessageForLater :: Statement BatchSendMessageForLater [MessageId] batchSendMessageForLater = preparable sql batchSendMessageForLaterEncoder decoder where@@ -128,7 +128,7 @@ decoder = D.rowList messageIdDecoder -- | Send a message with headers (pgmq 1.5.0+)--- https://tembo.io/pgmq/api/sql/functions/#send+-- https://pgmq.github.io/pgmq/api/sql/functions/#send -- Note: coalesce handles null delay to ensure correct function overload resolution sendMessageWithHeaders :: Statement SendMessageWithHeaders MessageId sendMessageWithHeaders = preparable sql sendMessageWithHeadersEncoder decoder@@ -137,7 +137,7 @@ decoder = D.singleRow messageIdDecoder -- | Send a message with headers for later (pgmq 1.5.0+)--- https://tembo.io/pgmq/api/sql/functions/#send+-- https://pgmq.github.io/pgmq/api/sql/functions/#send sendMessageWithHeadersForLater :: Statement SendMessageWithHeadersForLater MessageId sendMessageWithHeadersForLater = preparable sql sendMessageWithHeadersForLaterEncoder decoder where@@ -145,7 +145,7 @@ decoder = D.singleRow messageIdDecoder -- | Send a batch of messages with headers (pgmq 1.5.0+)--- https://tembo.io/pgmq/api/sql/functions/#send_batch+-- https://pgmq.github.io/pgmq/api/sql/functions/#send_batch -- Note: coalesce handles null delay to ensure correct function overload resolution batchSendMessageWithHeaders :: Statement BatchSendMessageWithHeaders [MessageId] batchSendMessageWithHeaders = preparable sql batchSendMessageWithHeadersEncoder decoder@@ -154,14 +154,14 @@ decoder = D.rowList messageIdDecoder -- | Send a batch of messages with headers for later (pgmq 1.5.0+)--- https://tembo.io/pgmq/api/sql/functions/#send_batch+-- https://pgmq.github.io/pgmq/api/sql/functions/#send_batch batchSendMessageWithHeadersForLater :: Statement BatchSendMessageWithHeadersForLater [MessageId] batchSendMessageWithHeadersForLater = preparable sql batchSendMessageWithHeadersForLaterEncoder decoder where sql = "select * from pgmq.send_batch($1, $2, $3, $4)" decoder = D.rowList messageIdDecoder --- | https://tembo.io/pgmq/api/sql/functions/#read+-- | https://pgmq.github.io/pgmq/api/sql/functions/#read -- Note: conditional parameter added in pgmq 1.5.0 -- We use the 3-param version since the 4-param version fails with NULL conditional -- (message @> NULL = NULL, not TRUE, so no rows match).@@ -172,28 +172,28 @@ sql = "select * from pgmq.read($1,$2,$3)" decoder = D.rowVector messageDecoder --- | https://tembo.io/pgmq/api/sql/functions/#delete-single+-- | https://pgmq.github.io/pgmq/api/sql/functions/#delete-single deleteMessage :: Statement MessageQuery Bool deleteMessage = preparable sql messageQueryEncoder decoder where sql = "select * from pgmq.delete($1,$2)" decoder = D.singleRow (D.column (D.nonNullable D.bool)) --- | https://tembo.io/pgmq/api/sql/functions/#delete-batch+-- | https://pgmq.github.io/pgmq/api/sql/functions/#delete-batch batchDeleteMessages :: Statement BatchMessageQuery [MessageId] batchDeleteMessages = preparable sql batchMessageQueryEncoder decoder where sql = "select * from pgmq.delete($1,$2)" decoder = D.rowList messageIdDecoder --- | https://tembo.io/pgmq/api/sql/functions/#archive-single+-- | https://pgmq.github.io/pgmq/api/sql/functions/#archive-single archiveMessage :: Statement MessageQuery Bool archiveMessage = preparable sql messageQueryEncoder decoder where sql = "select * from pgmq.archive($1,$2)" decoder = D.singleRow (D.column (D.nonNullable D.bool)) --- | https://tembo.io/pgmq/api/sql/functions/#archive-batch+-- | https://pgmq.github.io/pgmq/api/sql/functions/#archive-batch batchArchiveMessages :: Statement BatchMessageQuery [MessageId] batchArchiveMessages = preparable sql batchMessageQueryEncoder decoder where@@ -201,7 +201,7 @@ decoder = D.rowList messageIdDecoder -- | Permanently deletes all messages in a queue. Returns the number of messages that were deleted.--- | https://tembo.io/pgmq/api/sql/functions/#purge_queue+-- | https://pgmq.github.io/pgmq/api/sql/functions/#purge_queue deleteAllMessagesFromQueue :: Statement QueueName Int64 deleteAllMessagesFromQueue = preparable sql queueNameEncoder decoder where@@ -209,7 +209,7 @@ decoder = D.singleRow $ D.column $ D.nonNullable D.int8 -- | Sets the visibility timeout of a message to a specified time duration in the future. Returns the record of the message that was updated.--- | https://tembo.io/pgmq/api/sql/functions/#set_vt+-- | https://pgmq.github.io/pgmq/api/sql/functions/#set_vt changeVisibilityTimeout :: Statement VisibilityTimeoutQuery Message changeVisibilityTimeout = preparable sql visibilityTimeoutQueryEncoder decoder where@@ -217,7 +217,7 @@ decoder = D.singleRow messageDecoder -- | Batch update visibility timeout for multiple messages (pgmq 1.8.0+)--- | https://tembo.io/pgmq/api/sql/functions/#set_vt+-- | https://pgmq.github.io/pgmq/api/sql/functions/#set_vt batchChangeVisibilityTimeout :: Statement BatchVisibilityTimeoutQuery (Vector Message) batchChangeVisibilityTimeout = preparable sql batchVisibilityTimeoutQueryEncoder decoder where@@ -225,7 +225,7 @@ decoder = D.rowVector messageDecoder -- | Set visibility timeout to an absolute timestamp (pgmq 1.10.0+)--- | https://tembo.io/pgmq/api/sql/functions/#set_vt+-- | https://pgmq.github.io/pgmq/api/sql/functions/#set_vt setVisibilityTimeoutAt :: Statement VisibilityTimeoutAtQuery Message setVisibilityTimeoutAt = preparable sql visibilityTimeoutAtQueryEncoder decoder where@@ -233,14 +233,14 @@ decoder = D.singleRow messageDecoder -- | Batch set visibility timeout to an absolute timestamp (pgmq 1.10.0+)--- | https://tembo.io/pgmq/api/sql/functions/#set_vt+-- | https://pgmq.github.io/pgmq/api/sql/functions/#set_vt batchSetVisibilityTimeoutAt :: Statement BatchVisibilityTimeoutAtQuery (Vector Message) batchSetVisibilityTimeoutAt = preparable sql batchVisibilityTimeoutAtQueryEncoder decoder where sql = "select * from pgmq.set_vt($1,$2,$3)" decoder = D.rowVector messageDecoder --- | https://tembo.io/pgmq/api/sql/functions/#read_with_poll+-- | https://pgmq.github.io/pgmq/api/sql/functions/#read_with_poll readWithPoll :: Statement ReadWithPollMessage (Vector Message) readWithPoll = preparable sql readWithPollEncoder decoder where@@ -248,7 +248,7 @@ decoder = D.rowVector messageDecoder -- | Pop messages from queue (atomic read + delete)--- https://tembo.io/pgmq/api/sql/functions/#pop+-- https://pgmq.github.io/pgmq/api/sql/functions/#pop -- Note: qty parameter added in pgmq 1.7.0 pop :: Statement PopMessage (Vector Message) pop = preparable sql popMessageEncoder decoder@@ -258,7 +258,7 @@ -- | FIFO read - fills batch from same message group (pgmq 1.8.0+) -- Messages are grouped by the x-pgmq-group header.--- https://tembo.io/pgmq/api/sql/functions/#read_grouped+-- https://pgmq.github.io/pgmq/api/sql/functions/#read_grouped readGrouped :: Statement ReadGrouped (Vector Message) readGrouped = preparable sql readGroupedEncoder decoder where@@ -266,7 +266,7 @@ decoder = D.rowVector messageDecoder -- | FIFO read with polling - fills batch from same message group (pgmq 1.8.0+)--- https://tembo.io/pgmq/api/sql/functions/#read_grouped_with_poll+-- https://pgmq.github.io/pgmq/api/sql/functions/#read_grouped_with_poll readGroupedWithPoll :: Statement ReadGroupedWithPoll (Vector Message) readGroupedWithPoll = preparable sql readGroupedWithPollEncoder decoder where@@ -275,7 +275,7 @@ -- | Round-robin FIFO read - fair distribution across message groups (pgmq 1.9.0+) -- Uses layered round-robin algorithm for fairness.--- https://tembo.io/pgmq/api/sql/functions/#read_grouped_rr+-- https://pgmq.github.io/pgmq/api/sql/functions/#read_grouped_rr readGroupedRoundRobin :: Statement ReadGrouped (Vector Message) readGroupedRoundRobin = preparable sql readGroupedEncoder decoder where@@ -283,7 +283,7 @@ decoder = D.rowVector messageDecoder -- | Round-robin FIFO read with polling (pgmq 1.9.0+)--- https://tembo.io/pgmq/api/sql/functions/#read_grouped_rr_with_poll+-- https://pgmq.github.io/pgmq/api/sql/functions/#read_grouped_rr_with_poll readGroupedRoundRobinWithPoll :: Statement ReadGroupedWithPoll (Vector Message) readGroupedRoundRobinWithPoll = preparable sql readGroupedWithPollEncoder decoder where
src/Pgmq/Hasql/Statements/QueueManagement.hs view
@@ -23,33 +23,33 @@ import Pgmq.Hasql.Statements.Types (CreatePartitionedQueue, EnableNotifyInsert, UpdateNotifyInsert) import Pgmq.Types (NotifyInsertThrottle, QueueName) --- https://tembo.io/pgmq/api/sql/functions/#create+-- https://pgmq.github.io/pgmq/api/sql/functions/#create createQueue :: Statement QueueName () createQueue = preparable sql queueNameEncoder D.noResult where sql = "select from pgmq.create($1)" --- https://tembo.io/pgmq/api/sql/functions/#drop_queue+-- https://pgmq.github.io/pgmq/api/sql/functions/#drop_queue dropQueue :: Statement QueueName Bool dropQueue = preparable sql queueNameEncoder decoder where sql = "select * from pgmq.drop_queue($1)" decoder = D.singleRow (D.column (D.nonNullable D.bool)) --- | https://tembo.io/pgmq/api/sql/functions/#create_partitioned+-- | https://pgmq.github.io/pgmq/api/sql/functions/#create_partitioned createPartitionedQueue :: Statement CreatePartitionedQueue () createPartitionedQueue = preparable sql createPartitionedQueueEncoder D.noResult where sql = "select from pgmq.create_partitioned($1,$2,$3)" --- | https://tembo.io/pgmq/api/sql/functions/#create_unlogged+-- | https://pgmq.github.io/pgmq/api/sql/functions/#create_unlogged createUnloggedQueue :: Statement QueueName () createUnloggedQueue = preparable sql queueNameEncoder D.noResult where sql = "select from pgmq.create_unlogged($1)" -- | DEPRECATED: detach_archive is a no-op in pgmq and will be removed in pgmq 2.0--- https://tembo.io/pgmq/api/sql/functions/#detach_archive+-- https://pgmq.github.io/pgmq/api/sql/functions/#detach_archive detachArchive :: Statement QueueName () detachArchive = preparable sql queueNameEncoder D.noResult where
src/Pgmq/Hasql/Statements/QueueObservability.hs view
@@ -14,21 +14,21 @@ import Pgmq.Types (Queue, QueueName) -- | List all queues that currently exist--- | https://tembo.io/pgmq/api/sql/functions/#list_queues+-- | https://pgmq.github.io/pgmq/api/sql/functions/#list_queues listQueues :: Statement () [Queue] listQueues = preparable sql E.noParams decoder where sql = "select * from pgmq.list_queues()" decoder = D.rowList queueDecoder --- | https://tembo.io/pgmq/api/sql/functions/#metrics+-- | https://pgmq.github.io/pgmq/api/sql/functions/#metrics queueMetrics :: Statement QueueName QueueMetrics queueMetrics = preparable sql queueNameEncoder decoder where sql = "select * from pgmq.metrics($1)" decoder = D.singleRow queueMetricsDecoder --- | https://tembo.io/pgmq/api/sql/functions/#metrics_all+-- | https://pgmq.github.io/pgmq/api/sql/functions/#metrics_all allQueueMetrics :: Statement () [QueueMetrics] allQueueMetrics = preparable sql E.noParams decoder where