array package:hasql
Lift an array encoder into a value encoder.
Generic array encoder.
Here's an example of its usage:
someParamsEncoder :: Params [[Int64]]
someParamsEncoder = param (nonNullable (array (dimension foldl' (dimension foldl' (element (nonNullable int8))))))
Please note that the PostgreSQL
IN keyword does not accept an
array, but rather a syntactical list of values, thus this encoder is
not suited for that. Use a
value = ANY($1) condition instead.
Lift a value decoder of element into a unidimensional array decoder
producing a list.
This function is merely a shortcut to the following expression:
(array . dimension Control.Monad.replicateM . element)
Please notice that in case of multidimensional arrays nesting
listArray decoder won't work. You have to explicitly construct
the array decoder using
array.
Lift a value decoder of element into a unidimensional array decoder
producing a generic vector.
This function is merely a shortcut to the following expression:
(array . dimension Data.Vector.Generic.replicateM . element)
Please notice that in case of multidimensional arrays nesting
vectorArray decoder won't work. You have to explicitly
construct the array decoder using
array.
Lift a value encoder of element into a unidimensional array encoder of
a foldable value.
This function is merely a shortcut to the following expression:
(array . dimension foldl' . element)
You can use it like this:
vectorOfInts :: Value (Vector Int64)
vectorOfInts = foldableArray (nonNullable int8)
Please notice that in case of multidimensional arrays nesting
foldableArray encoder won't work. You have to explicitly
construct the array encoder using
array.