hasql-notifications 0.2.3.2 → 0.2.4.0
raw patch · 4 files changed
+15/−8 lines, 4 filesdep ~hasqldep ~hasql-pool
Dependency ranges changed: hasql, hasql-pool
Files
- app/Main.hs +3/−2
- hasql-notifications.cabal +3/−3
- src/Hasql/Notifications.hs +6/−2
- test/Hasql/NotificationsSpec.hs +3/−1
app/Main.hs view
@@ -4,6 +4,8 @@ import System.Exit (die) import Hasql.Connection+import Hasql.Connection.Setting+import Hasql.Connection.Setting.Connection import Hasql.Notifications main :: IO ()@@ -11,11 +13,10 @@ hSetBuffering stdout NoBuffering hSetBuffering stderr NoBuffering - dbOrError <- acquire "postgres://localhost/db_name"+ dbOrError <- acquire [ connection $ string "postgres://localhost/db_name" ] case dbOrError of Right db -> do let channelToListen = toPgIdentifier "sample-channel" listen db channelToListen waitForNotifications (\channel _ -> print $ "Just got notification on channel " <> channel) db _ -> die "Could not open database connection"-
hasql-notifications.cabal view
@@ -1,5 +1,5 @@ name: hasql-notifications-version: 0.2.3.2+version: 0.2.4.0 synopsis: LISTEN/NOTIFY support for Hasql description: Use PostgreSQL Asynchronous notification support with your Hasql Types. homepage: https://github.com/diogob/hasql-notifications@@ -19,9 +19,9 @@ build-depends: base >= 4.7 && < 5 , bytestring >= 0.10.8.2 && < 0.13 , text >= 2 && < 2.2- , hasql-pool >= 1.2 && < 1.3+ , hasql-pool >= 1.3 && < 1.4 , postgresql-libpq >= 0.9 && < 1.0- , hasql >= 0.19 && < 1.9+ , hasql >= 1.9 && < 1.10 default-language: Haskell2010 ghc-options: -Wall
src/Hasql/Notifications.hs view
@@ -99,11 +99,13 @@ -- import System.Exit (die) -- -- import Hasql.Connection+-- import Hasql.Connection.Setting+-- import Hasql.Connection.Setting.Connection -- import Hasql.Notifications -- -- main :: IO () -- main = do--- dbOrError <- acquire "postgres://localhost/db_name"+-- dbOrError <- acquire [ connection $ string "postgres://localhost/db_name" ] -- case dbOrError of -- Right db -> do -- let channelToListen = toPgIdentifier "sample-channel"@@ -160,6 +162,8 @@ -- import System.Exit (die) -- -- import Hasql.Connection+-- import Hasql.Connection.Setting+-- import Hasql.Connection.Setting.Connection -- import Hasql.Notifications -- -- notificationHandler :: ByteString -> ByteString -> IO()@@ -169,7 +173,7 @@ -- -- main :: IO () -- main = do--- dbOrError <- acquire "postgres://localhost/db_name"+-- dbOrError <- acquire [ connection $ string "postgres://localhost/db_name" ] -- case dbOrError of -- Right db -> do -- let channelToListen = toPgIdentifier "sample-channel"
test/Hasql/NotificationsSpec.hs view
@@ -5,6 +5,8 @@ import Control.Monad (void) import Data.ByteString import Hasql.Connection+import Hasql.Connection.Setting+import Hasql.Connection.Setting.Connection import Hasql.Notifications import System.Exit (die) import Test.Hspec@@ -20,7 +22,7 @@ describe "send and receive notification" $ describe "when I send a notification to channel my handler is listening to" $ it "should call our notification handler" $ do- dbOrError <- acquire "postgres://postgres:roottoor@localhost/hasql_notifications_test"+ dbOrError <- acquire [ connection $ string "postgres://postgres:roottoor@localhost/hasql_notifications_test"] case dbOrError of Right db -> do let channelToListen = toPgIdentifier "test-channel"