packages feed

postgres-websockets 0.12.0.0 → 0.12.1.0

raw patch · 3 files changed

+13/−14 lines, 3 filesdep ~hasqldep ~hasql-pool

Dependency ranges changed: hasql, hasql-pool

Files

postgres-websockets.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                postgres-websockets-version:             0.12.0.0+version:             0.12.1.0 synopsis:            Middleware to map LISTEN/NOTIFY messages to Websockets description:         WAI middleware that adds websockets capabilites on top of PostgreSQL's asynchronous notifications using LISTEN and NOTIFY commands. Fully functioning server included. homepage:            https://github.com/diogob/postgres-websockets#readme@@ -44,9 +44,9 @@                      , bytestring >= 0.11.5 && < 0.13                      , either >= 5.0.1.1 && < 5.1                      , envparse >= 0.5.0 && < 0.7-                     , hasql >= 1.9 && < 1.10+                     , hasql >= 1.10 && < 1.20                      , hasql-notifications >= 0.2.4.0 && < 0.3-                     , hasql-pool ^>= 1.3+                     , hasql-pool ^>= 1.4                      , http-types >= 0.12.3 && < 0.13                      , jose >= 0.11 && < 0.13                      , lens >= 5.2.3 && < 5.4@@ -94,8 +94,8 @@                      , postgres-websockets                      , hspec >= 2.7.1 && < 2.12                      , aeson >= 2.0 && < 2.3-                     , hasql >= 1.9 && < 1.10-                     , hasql-pool ^>= 1.3+                     , hasql >= 1.10 && < 1.20+                     , hasql-pool ^>= 1.4                      , hasql-notifications >= 0.2.4.0 && < 0.3                      , http-types >= 0.9                      , time >= 1.8.0.2 && < 2
src/PostgresWebsockets/Context.hs view
@@ -16,8 +16,7 @@ import Data.Time.Clock (UTCTime, getCurrentTime) import qualified Hasql.Pool as P import qualified Hasql.Pool.Config as P-import qualified Hasql.Connection.Setting as C-import qualified Hasql.Connection.Setting.Connection as C+import qualified Hasql.Connection.Settings as C import PostgresWebsockets.Broadcast (Multiplexer) import PostgresWebsockets.Config (AppConfig (..)) import PostgresWebsockets.HasqlBroadcast (newHasqlBroadcaster)@@ -37,7 +36,7 @@     <*> newHasqlBroadcaster shutdown configListenChannel configRetries configReconnectInterval pgSettings     <*> mkGetTime   where-    config = P.settings [P.staticConnectionSettings [C.connection $ C.string $ decodeUtf8 pgSettings]]+    config = P.settings [P.staticConnectionSettings $ C.connectionString $ decodeUtf8 pgSettings]     shutdown =       maybe         shutdownServer
src/PostgresWebsockets/HasqlBroadcast.hs view
@@ -21,10 +21,10 @@ import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as JSON import Data.Either.Combinators (mapBoth)-import Hasql.Connection (Connection, ConnectionError)+import Hasql.Connection (Connection)+import Hasql.Errors (ConnectionError) import qualified Hasql.Connection as HC-import qualified Hasql.Connection.Setting as HC-import qualified Hasql.Connection.Setting.Connection as HC+import qualified Hasql.Connection.Settings as HC import qualified Hasql.Decoders as HD import qualified Hasql.Encoders as HE import Hasql.Notifications@@ -33,7 +33,7 @@ import PostgresWebsockets.Broadcast  acquire :: ByteString -> IO (Either ConnectionError Connection)-acquire settings = HC.acquire  [HC.connection $ HC.string $ decodeUtf8 settings]+acquire settings = HC.acquire $ HC.connectionString $ decodeUtf8 settings -- | Returns a multiplexer from a connection URI, keeps trying to connect in case there is any error. --   This function also spawns a thread that keeps relaying the messages from the database to the multiplexer's listeners newHasqlBroadcaster :: IO () -> Text -> Int -> Maybe Int -> ByteString -> IO Multiplexer@@ -122,7 +122,7 @@  isListening :: Connection -> Text -> IO Bool isListening con ch = do-  resultOrError <- H.run session con+  resultOrError <- HC.use con session   pure $ fromRight False resultOrError   where     session = H.statement chPattern isListeningStatement@@ -130,7 +130,7 @@  isListeningStatement :: H.Statement Text Bool isListeningStatement =-  H.Statement sql encoder decoder True+  H.preparable sql encoder decoder   where     sql = "select exists (select * from pg_stat_activity where datname = current_database() and query ilike $1);"     encoder = HE.param $ HE.nonNullable HE.text