refactor: add Hasql arrayColumn decoder
This commit is contained in:
committed by
Steve Chavez
parent
04eaeec7fc
commit
a6696f3ba1
@@ -98,10 +98,10 @@ decodeRels tables cols =
|
|||||||
<$> column HD.text
|
<$> column HD.text
|
||||||
<*> column HD.text
|
<*> column HD.text
|
||||||
<*> column HD.text
|
<*> column HD.text
|
||||||
<*> column (HD.array (HD.dimension replicateM (element HD.text)))
|
<*> arrayColumn HD.text
|
||||||
<*> column HD.text
|
<*> column HD.text
|
||||||
<*> column HD.text
|
<*> column HD.text
|
||||||
<*> column (HD.array (HD.dimension replicateM (element HD.text)))
|
<*> arrayColumn HD.text
|
||||||
|
|
||||||
decodePks :: [Table] -> HD.Result [PrimaryKey]
|
decodePks :: [Table] -> HD.Result [PrimaryKey]
|
||||||
decodePks tables =
|
decodePks tables =
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ column = HD.column . HD.nonNullable
|
|||||||
nullableColumn :: HD.Value a -> HD.Row (Maybe a)
|
nullableColumn :: HD.Value a -> HD.Row (Maybe a)
|
||||||
nullableColumn = HD.column . HD.nullable
|
nullableColumn = HD.column . HD.nullable
|
||||||
|
|
||||||
element :: HD.Value a -> HD.Array a
|
arrayColumn :: HD.Value a -> HD.Row [a]
|
||||||
element = HD.element . HD.nonNullable
|
arrayColumn = column . HD.array . HD.dimension replicateM . HD.element . HD.nonNullable
|
||||||
|
|
||||||
param :: HE.Value a -> HE.Params a
|
param :: HE.Value a -> HE.Params a
|
||||||
param = HE.param . HE.nonNullable
|
param = HE.param . HE.nonNullable
|
||||||
|
|||||||
@@ -120,11 +120,9 @@ createReadStatement selectQuery countQuery isSingle countTotal asCsv binaryField
|
|||||||
-}
|
-}
|
||||||
standardRow :: HD.Row ResultsWithCount
|
standardRow :: HD.Row ResultsWithCount
|
||||||
standardRow = (,,,,,) <$> nullableColumn HD.int8 <*> column HD.int8
|
standardRow = (,,,,,) <$> nullableColumn HD.int8 <*> column HD.int8
|
||||||
<*> column header <*> column HD.bytea
|
<*> arrayColumn HD.bytea <*> column HD.bytea
|
||||||
<*> (fromMaybe (Right []) <$> nullableColumn decodeGucHeaders)
|
<*> (fromMaybe (Right []) <$> nullableColumn decodeGucHeaders)
|
||||||
<*> (fromMaybe (Right Nothing) <$> nullableColumn decodeGucStatus)
|
<*> (fromMaybe (Right Nothing) <$> nullableColumn decodeGucStatus)
|
||||||
where
|
|
||||||
header = HD.array $ HD.dimension replicateM $ element HD.bytea
|
|
||||||
|
|
||||||
type ProcResults = (Maybe Int64, Int64, ByteString, Either SimpleError [GucHeader], Either SimpleError (Maybe Status))
|
type ProcResults = (Maybe Int64, Int64, ByteString, Either SimpleError [GucHeader], Either SimpleError (Maybe Status))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user