mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-06 04:16:21 +03:00
add generalized table initializer.
This commit is contained in:
parent
ec3125128a
commit
a718ab2925
@ -18,6 +18,7 @@ cabal-version: >=1.10
|
||||
library
|
||||
exposed-modules:
|
||||
Test.Relational.QuickCheck.Model
|
||||
Test.Relational.QuickCheck.Transaction
|
||||
Test.Relational.QuickCheck.Arbitrary
|
||||
-- other-modules:
|
||||
other-extensions: TemplateHaskell, MultiParamTypeClasses, FlexibleInstances
|
||||
@ -25,6 +26,7 @@ library
|
||||
, QuickCheck >=2
|
||||
, HDBC
|
||||
, HDBC-session
|
||||
, persistable-record
|
||||
, relational-query
|
||||
, relational-query-HDBC
|
||||
hs-source-dirs: src
|
||||
|
17
rr-quickcheck/src/Test/Relational/QuickCheck/Transaction.hs
Normal file
17
rr-quickcheck/src/Test/Relational/QuickCheck/Transaction.hs
Normal file
@ -0,0 +1,17 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
|
||||
module Test.Relational.QuickCheck.Transaction (
|
||||
initializeTable,
|
||||
) where
|
||||
|
||||
import Database.HDBC (IConnection, SqlValue)
|
||||
import Database.Record (ToSql)
|
||||
import Database.Relational.Query
|
||||
import Database.HDBC.Record (runInsert)
|
||||
|
||||
|
||||
initializeTable :: (IConnection conn, TableDerivable a, ToSql SqlValue a)
|
||||
=> conn
|
||||
-> [a]
|
||||
-> IO ()
|
||||
initializeTable conn xs = mapM_ (runInsert conn $ derivedInsert id') xs
|
Loading…
Reference in New Issue
Block a user