hasql-notifications 0.2.5.0 → 0.2.6.0
raw patch · 4 files changed
+16/−13 lines, 4 filesdep +pqidep +pqi-ffidep −postgresql-libpqdep ~hasqldep ~hasql-pool
Dependencies added: pqi, pqi-ffi
Dependencies removed: postgresql-libpq
Dependency ranges changed: hasql, hasql-pool
Files
- app/Main.hs +3/−1
- hasql-notifications.cabal +6/−4
- src/Hasql/Notifications.hs +5/−7
- test/Hasql/NotificationsSpec.hs +2/−1
app/Main.hs view
@@ -6,12 +6,14 @@ import Hasql.Connection import Hasql.Notifications +import qualified Pqi.Ffi+ main :: IO () main = do hSetBuffering stdout NoBuffering hSetBuffering stderr NoBuffering - dbOrError <- acquire "postgres://localhost/db_name"+ dbOrError <- acquire Pqi.Ffi.adapter "postgres://localhost/db_name" case dbOrError of Right db -> do let channelToListen = toPgIdentifier "sample-channel"
hasql-notifications.cabal view
@@ -1,5 +1,5 @@ name: hasql-notifications-version: 0.2.5.0+version: 0.2.6.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.4 && < 1.5- , postgresql-libpq >= 0.9 && < 1.0- , hasql >= 1.10 && < 1.11+ , hasql-pool >= 1.5 && < 1.6+ , pqi >= 1.1 && < 1.2+ , hasql >= 2.0 && < 2.1 default-language: Haskell2010 ghc-options: -Wall@@ -34,6 +34,7 @@ build-depends: base , hasql , hasql-notifications+ , pqi-ffi >= 1.0 && < 1.1 default-language: Haskell2010 default-extensions: OverloadedStrings @@ -47,6 +48,7 @@ , hasql-notifications , hspec , bytestring+ , pqi-ffi >= 1.0 && < 1.1 , QuickCheck build-tool-depends: hspec-discover:hspec-discover >=2.11.12 && <3 ghc-options: -threaded -rtsopts -with-rtsopts=-N
src/Hasql/Notifications.hs view
@@ -29,7 +29,6 @@ import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T-import qualified Database.PostgreSQL.LibPQ as PQ import Hasql.Connection (Connection) import qualified Hasql.Connection as Connection import qualified Hasql.Decoders as HD@@ -38,6 +37,7 @@ import Hasql.Pool (Pool, UsageError, use) import qualified Hasql.Session as Session import qualified Hasql.Statement as Statement+import qualified Pqi as PQ -- | A wrapped text that represents a properly escaped and quoted PostgreSQL identifier newtype PgIdentifier = PgIdentifier Text deriving (Show)@@ -101,13 +101,12 @@ -- import System.Exit (die) -- -- import Hasql.Connection--- import Hasql.Connection.Setting--- import Hasql.Connection.Setting.Connection -- import Hasql.Notifications+-- import qualified Pqi.Ffi -- -- main :: IO () -- main = do--- dbOrError <- acquire [ connection $ string "postgres://localhost/db_name" ]+-- dbOrError <- acquire Pqi.Ffi.adapter "postgres://localhost/db_name" -- case dbOrError of -- Right db -> do -- let channelToListen = toPgIdentifier "sample-channel"@@ -168,9 +167,8 @@ -- import System.Exit (die) -- -- import Hasql.Connection--- import Hasql.Connection.Setting--- import Hasql.Connection.Setting.Connection -- import Hasql.Notifications+-- import qualified Pqi.Ffi -- -- notificationHandler :: ByteString -> ByteString -> IO() -- notificationHandler channel payload =@@ -179,7 +177,7 @@ -- -- main :: IO () -- main = do--- dbOrError <- acquire [ connection $ string "postgres://localhost/db_name" ]+-- dbOrError <- acquire Pqi.Ffi.adapter "postgres://localhost/db_name" -- case dbOrError of -- Right db -> do -- let channelToListen = toPgIdentifier "sample-channel"
test/Hasql/NotificationsSpec.hs view
@@ -6,6 +6,7 @@ import Data.ByteString import Hasql.Connection import Hasql.Notifications+import qualified Pqi.Ffi import System.Exit (die) import Test.Hspec import Test.QuickCheck@@ -20,7 +21,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 Pqi.Ffi.adapter "postgres://postgres:roottoor@localhost/hasql_notifications_test" case dbOrError of Right db -> do let channelToListen = toPgIdentifier "test-channel"