Skip to content

Commit 722af9b

Browse files
committed
FAIL: How to make this generic?
1 parent f1104aa commit 722af9b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

squeal-postgresql/exe/Example.hs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
, TypeOperators
1010
#-}
1111

12+
{-# LANGUAGE ScopedTypeVariables #-}
13+
14+
1215
module Main (main, main2, upsertUser) where
1316

1417
import Control.Monad.IO.Class (MonadIO (..))
@@ -124,14 +127,15 @@ getOrganizations = select_
124127
(from (table (#org ! #organizations `as` #o)))
125128

126129
getOrganizationsBy ::
130+
forall pgty hsty.
127131
Condition
128132
'Ungrouped
129133
'[]
130134
'[]
131135
Schemas
132-
'[ 'NotNull 'PGint4]
136+
'[ 'NotNull pgty ]
133137
'["o" ::: ["id" ::: NotNull PGint4, "name" ::: NotNull PGtext]] ->
134-
Query_ Schemas (Only Int32) Organization
138+
Query_ Schemas (Only hsty) Organization
135139
getOrganizationsBy condition =
136140
select_
137141
(#o ! #id `as` #orgId :* #o ! #name `as` #orgName)
@@ -205,6 +209,11 @@ session = do
205209
organizationRows2 <- getRows organizationsResult2
206210
liftIO $ print (organizationRows2 :: [Organization])
207211

212+
organizationsResult3 <- runQueryParams
213+
(getOrganizationsBy ((#o ! #name) .== param @1)) (Only ("ACME" :: Text))
214+
organizationRows3 <- getRows organizationsResult3
215+
liftIO $ print (organizationRows2 :: [Organization])
216+
208217
main :: IO ()
209218
main = do
210219
Char8.putStrLn "===> squeal"

0 commit comments

Comments
 (0)