The schema to use can be selected through the headers `Accept-Profile` for GET/HEAD and `Content-Profile` for POST/PATCH/PUT/DELETE. This is based on the https://www.w3.org/TR/dx-prof-conneg/ttps://www.w3.org/TR/dx-prof-conneg/ spec. Also increase all memory tests by 1M(otherwise CI fails). Co-authored-by: Mahmoud Kassem <MKassem@gk-software.com> Co-authored-by: Mahmoud Kassem <mahmoud_k@mail.com>
26 lines
678 B
Haskell
26 lines
678 B
Haskell
{-|
|
|
Module : PostgREST.Common
|
|
Description : Common helper functions.
|
|
-}
|
|
module PostgREST.Private.Common where
|
|
|
|
import Data.Maybe
|
|
import qualified Hasql.Decoders as HD
|
|
import qualified Hasql.Encoders as HE
|
|
import Protolude
|
|
|
|
column :: HD.Value a -> HD.Row a
|
|
column = HD.column . HD.nonNullable
|
|
|
|
nullableColumn :: HD.Value a -> HD.Row (Maybe a)
|
|
nullableColumn = HD.column . HD.nullable
|
|
|
|
element :: HD.Value a -> HD.Array a
|
|
element = HD.element . HD.nonNullable
|
|
|
|
param :: HE.Value a -> HE.Params a
|
|
param = HE.param . HE.nonNullable
|
|
|
|
arrayParam :: HE.Value a -> HE.Params [a]
|
|
arrayParam = param . HE.array . HE.dimension foldl' . HE.element . HE.nonNullable
|