refactor: Replace interpolatedstring-perl6 with neat-interpolation

The former depends on th-orphans which does not cross-compile well,
because of template haskell usage.

neat-interpolation is also much better maintained.

This also potentially helps with packaging for Debian/Ubuntu in #2273.
This commit is contained in:
Wolfgang Walther
2024-06-16 14:01:46 +02:00
committed by Wolfgang Walther
parent 0b25039f0f
commit e5fb1e0ec1
4 changed files with 40 additions and 39 deletions
+5 -5
View File
@@ -53,8 +53,8 @@ import qualified Hasql.Encoders as HE
import Control.Arrow ((***))
import Data.Foldable (foldr1)
import Text.InterpolatedString.Perl6 (qc)
import Data.Foldable (foldr1)
import NeatInterpolation (trimming)
import PostgREST.ApiRequest.Types (AggregateFunction (..),
Alias, Cast,
@@ -229,11 +229,11 @@ customFuncF _ funcQi RelAnyElement = fromQi funcQi <> "(_postgrest_t)
customFuncF _ funcQi (RelId target) = fromQi funcQi <> "(_postgrest_t::" <> fromQi target <> ")"
locationF :: [Text] -> SQL.Snippet
locationF pKeys = [qc|(
WITH data AS (SELECT row_to_json(_) AS row FROM {sourceCTEName} AS _ LIMIT 1)
locationF pKeys = SQL.sql $ encodeUtf8 [trimming|(
WITH data AS (SELECT row_to_json(_) AS row FROM ${sourceCTEName} AS _ LIMIT 1)
SELECT array_agg(json_data.key || '=' || coalesce('eq.' || json_data.value, 'is.null'))
FROM data CROSS JOIN json_each_text(data.row) AS json_data
WHERE json_data.key IN ('{fmtPKeys}')
WHERE json_data.key IN ('${fmtPKeys}')
)|]
where
fmtPKeys = T.intercalate "','" pKeys