tests for &select= feature and support for casting columns (usefull when extracting subfields from json columns)

This commit is contained in:
Ruslan Talpa
2015-09-05 15:05:53 +03:00
parent 6c16395dfb
commit 9c8ac2a489
5 changed files with 75 additions and 9 deletions
+13
View File
@@ -13,6 +13,7 @@ import Data.Monoid
import Data.Text hiding (map)
import qualified Data.Vector as V
import Control.Monad (void)
import Control.Applicative
import Network.HTTP.Types.Header (Header, ByteRange, renderByteRange,
hRange, hAuthorization, hAccept)
@@ -118,6 +119,18 @@ createItems n = do
txn = mapM_ H.unitEx stmts
stmts = map [H.stmt|insert into "1".items (id) values (?)|] [1..n]
createComplexItems :: IO ()
createComplexItems = do
pool <- testPool
void . liftIO $ H.session pool $ H.tx Nothing txn
where
txn = mapM_ H.unitEx stmts
stmts = getZipList $ [H.stmt|insert into "1".complex_items (id, name, settings) values (?,?,?)|]
<$> ZipList ([1..3]::[Int])
<*> ZipList (["One", "Two", "Three"]::[Text])
<*> ZipList ([jobj,jobj,jobj])
jobj = (J.object [("foo", J.object [("int", J.Number 1),("bar", J.String "baz")])])
createNulls :: Int -> IO ()
createNulls n = do
pool <- testPool