Bump opium to remove dependency on postgresql-libpq
This commit is contained in:
parent
fda4e7530c
commit
a499c35d5b
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
import Database.PostgreSQL.LibPQ (connectdb)
|
import qualified Database.PostgreSQL.Opium as Opium
|
||||||
|
|
||||||
import qualified Yore.DB
|
import qualified Yore.DB
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
conn <- connectdb "host=localhost port=5432"
|
conn <- Opium.connect "host=localhost port=5432"
|
||||||
result <- Yore.DB.getTables conn
|
result <- Yore.DB.getTables conn
|
||||||
|
|
||||||
case result of
|
case result of
|
||||||
|
|||||||
8
flake.lock
generated
8
flake.lock
generated
@ -64,11 +64,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1752596794,
|
"lastModified": 1752614832,
|
||||||
"narHash": "sha256-1J3tNaosj3DCQuzDCPdbEbOd5ZQuqIOAVD7o5hFNx+g=",
|
"narHash": "sha256-rwLQ1xsYus6on4PSTwM2ti36Iwk5gr9lDKwFOZ451OI=",
|
||||||
"ref": "main",
|
"ref": "main",
|
||||||
"rev": "3879c2603fa124087a3ed810903bf75d38a27598",
|
"rev": "2fddc958b9e6b616f89570dfa44503bccd165c02",
|
||||||
"revCount": 56,
|
"revCount": 59,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pbrinkmeier.de/paul/opium"
|
"url": "https://git.pbrinkmeier.de/paul/opium"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,7 +5,6 @@ module Yore.DB
|
|||||||
, getTables
|
, getTables
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Database.PostgreSQL.LibPQ (Connection)
|
|
||||||
import GHC.Generics (Generic)
|
import GHC.Generics (Generic)
|
||||||
|
|
||||||
import qualified Database.PostgreSQL.Opium as Opium
|
import qualified Database.PostgreSQL.Opium as Opium
|
||||||
@ -17,5 +16,5 @@ data Table = Table
|
|||||||
|
|
||||||
instance Opium.FromRow Table
|
instance Opium.FromRow Table
|
||||||
|
|
||||||
getTables :: Connection -> IO (Either Opium.Error [Table])
|
getTables :: Opium.Connection -> IO (Either Opium.Error [Table])
|
||||||
getTables = Opium.fetch_ "SELECT table_schema AS schema, table_name AS name FROM information_schema.tables"
|
getTables = Opium.fetch_ "SELECT table_schema AS schema, table_name AS name FROM information_schema.tables"
|
||||||
|
|||||||
@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
module Yore.Repl (connect, exec) where
|
module Yore.Repl (connect, exec) where
|
||||||
|
|
||||||
import qualified Database.PostgreSQL.LibPQ as LibPQ
|
import qualified Database.PostgreSQL.Opium as Opium
|
||||||
|
|
||||||
import Database.PostgreSQL.LibPQ (Connection)
|
connect :: IO Opium.Connection
|
||||||
|
connect = Opium.connect "host=localhost"
|
||||||
|
|
||||||
connect :: IO Connection
|
exec :: (Opium.Connection -> IO a) -> IO a
|
||||||
connect = LibPQ.connectdb "host=localhost"
|
|
||||||
|
|
||||||
exec :: (Connection -> IO a) -> IO a
|
|
||||||
exec f = f =<< connect
|
exec f = f =<< connect
|
||||||
|
|||||||
@ -38,7 +38,6 @@ library
|
|||||||
build-depends:
|
build-depends:
|
||||||
base >=4.18 && <5
|
base >=4.18 && <5
|
||||||
, opium
|
, opium
|
||||||
, postgresql-libpq
|
|
||||||
|
|
||||||
executable yore
|
executable yore
|
||||||
import: shared-options
|
import: shared-options
|
||||||
@ -57,7 +56,6 @@ executable yore
|
|||||||
, bytestring
|
, bytestring
|
||||||
, http-media
|
, http-media
|
||||||
, opium
|
, opium
|
||||||
, postgresql-libpq
|
|
||||||
, servant-server
|
, servant-server
|
||||||
, text
|
, text
|
||||||
, wai
|
, wai
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user