2 ms·
Opaleye can do this https://hackage.haskell.org/package/opaleye https://hackage.haskell.org/package/opaleye (The generated code may not be the easiest to read
by tome 9y ago
Opaleye can do this
https://hackage.haskell.org/package/opaleye https://hackage.haskell.org/package/opaleye
(The generated code may not be the easiest to read, but I hope the point comes across)
> let paulHoulesFunction = (\x -> 5 * x - 2 * x * x + 7); paulHoulesFunction :: Num a
=> a -> a
> traverse_ putStrLn (showSqlForPostgres (queryTable table1))
SELECT "column10_1" as "result1_2",
"column21_1" as "result2_2"
FROM (SELECT *
FROM (SELECT "column1" as "column10_1",
"column2" as "column21_1"
FROM "table1" as "T1") as "T1") as "T1"
> traverse_ putStrLn (showSqlForPostgres ((fmap . fmap) paulHoulesFunction (queryTable table1)))
SELECT "column10_1" as "result1_2",
((5 * ("column21_1")) - ((2 * ("column21_1")) * ("column21_1"))) + 7 as "result2_2"
FROM (SELECT *
FROM (SELECT "column1" as "column10_1",
"column2" as "column21_1"
FROM "table1" as "T1") as "T1") as "T1"