mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-26 23:33:02 +03:00
Fix the Composite decoder
This commit is contained in:
parent
a802f907a4
commit
08564ab360
@ -1,7 +1,7 @@
|
||||
name:
|
||||
hasql
|
||||
version:
|
||||
0.19.15.1
|
||||
0.19.15.2
|
||||
category:
|
||||
Hasql, Database, PostgreSQL
|
||||
synopsis:
|
||||
@ -74,7 +74,7 @@ library
|
||||
-- parsing:
|
||||
attoparsec >= 0.10 && < 0.14,
|
||||
-- database:
|
||||
postgresql-binary >= 0.9 && < 0.10,
|
||||
postgresql-binary >= 0.9.1.1 && < 0.10,
|
||||
postgresql-libpq == 0.9.*,
|
||||
-- builders:
|
||||
bytestring-tree-builder >= 0.2.5 && < 0.3,
|
||||
|
@ -22,6 +22,23 @@ tree =
|
||||
localOption (NumThreads 1) $
|
||||
testGroup "All tests"
|
||||
[
|
||||
testCase "Composite decoding" $
|
||||
let
|
||||
query =
|
||||
Query.statement sql encoder decoder True
|
||||
where
|
||||
sql =
|
||||
"select (1, true)"
|
||||
encoder =
|
||||
Encoders.unit
|
||||
decoder =
|
||||
Decoders.singleRow (Decoders.value (Decoders.composite ((,) <$> Decoders.compositeValue Decoders.int8 <*> Decoders.compositeValue Decoders.bool)))
|
||||
session =
|
||||
Session.query () query
|
||||
in do
|
||||
x <- Connection.with (Session.run session)
|
||||
assertEqual (show x) (Right (Right (1, True))) x
|
||||
,
|
||||
testCase "Empty array" $
|
||||
let
|
||||
io =
|
||||
|
Loading…
Reference in New Issue
Block a user