@@ -24,50 +24,50 @@ spec = do
25 statement :: Query '[] Tables Tables SumAndCol1
25 statement :: Query '[] Tables Tables SumAndCol1
26 statement = select $
26 statement = select $
27− project ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
27+ ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
28− & from (#table1 & where_ true)
28+ `from` (#table1 & where_ true)
29 statement `shouldRenderAs`
29 statement `shouldRenderAs`
30 "SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 WHERE TRUE;"
30 "SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 WHERE TRUE;"
31 it "combines WHEREs using AND" $ do
31 it "combines WHEREs using AND" $ do
33 statement :: Query '[] Tables Tables SumAndCol1
33 statement :: Query '[] Tables Tables SumAndCol1
34 statement = select $
34 statement = select $
35− project ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
35+ ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
36− & from (#table1 & where_ true & where_ false)
36+ `from` (#table1 & where_ true & where_ false)
37 statement `shouldRenderAs`
37 statement `shouldRenderAs`
38 "SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 WHERE (TRUE AND FALSE);"
38 "SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 WHERE (TRUE AND FALSE);"
39 it "performs sub SELECTs" $ do
39 it "performs sub SELECTs" $ do
41− selection = project ((#col1 + #col2) `As` #sum :& #col1 :& RNil) & from #table1
41+ selection = ((#col1 + #col2) `As` #sum :& #col1 :& RNil) `from` #table1
42 statement :: Query '[] Tables Tables SumAndCol1
42 statement :: Query '[] Tables Tables SumAndCol1
43− statement = select $ star & from (subselect (selection `As` #sub))
43+ statement = select $ starFrom (subselect (selection `As` #sub))
44 statement `shouldRenderAs`
44 statement `shouldRenderAs`
45 "SELECT * FROM SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 AS sub;"
45 "SELECT * FROM SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 AS sub;"
46 it "does LIMIT clauses" $ do
46 it "does LIMIT clauses" $ do
48 statement :: Query '[] Tables Tables Columns
48 statement :: Query '[] Tables Tables Columns
49− statement = select $ star & from (#table1 & limit 1)
49+ statement = select $ starFrom (#table1 & limit 1)
50 statement `shouldRenderAs` "SELECT * FROM table1 LIMIT 1;"
50 statement `shouldRenderAs` "SELECT * FROM table1 LIMIT 1;"
51 it "should use the minimum of given LIMITs" $ do
51 it "should use the minimum of given LIMITs" $ do
53 statement :: Query '[] Tables Tables Columns
53 statement :: Query '[] Tables Tables Columns
54− statement = select $ star & from (#table1 & limit 1 & limit 2)
54+ statement = select $ starFrom (#table1 & limit 1 & limit 2)
55 statement `shouldRenderAs`
55 statement `shouldRenderAs`
56 "SELECT * FROM table1 LIMIT CASE WHEN (1 <= 2) THEN 1 ELSE 2 END;"
56 "SELECT * FROM table1 LIMIT CASE WHEN (1 <= 2) THEN 1 ELSE 2 END;"
57 it "should render parameters using $ signs" $ do
57 it "should render parameters using $ signs" $ do
59 statement :: Query '[ 'PGInt8] Tables Tables Columns
59 statement :: Query '[ 'PGInt8] Tables Tables Columns
60− statement = select $ star & from (#table1 & limit param1)
60+ statement = select $ starFrom (#table1 & limit param1)
61 statement `shouldRenderAs` "SELECT * FROM table1 LIMIT $1;"
61 statement `shouldRenderAs` "SELECT * FROM table1 LIMIT $1;"
62 it "does OFFSET clauses" $ do
62 it "does OFFSET clauses" $ do
64 statement :: Query '[] Tables Tables Columns
64 statement :: Query '[] Tables Tables Columns
65− statement = select $ star & from (#table1 & offset 1)
65+ statement = select $ starFrom (#table1 & offset 1)
66 statement `shouldRenderAs` "SELECT * FROM table1 OFFSET 1;"
66 statement `shouldRenderAs` "SELECT * FROM table1 OFFSET 1;"
67 it "should use the sum of given OFFSETs" $ do
67 it "should use the sum of given OFFSETs" $ do
69 statement :: Query '[] Tables Tables Columns
69 statement :: Query '[] Tables Tables Columns
70− statement = select $ star & from (#table1 & offset 1 & offset 2)
70+ statement = select $ starFrom (#table1 & offset 1 & offset 2)
71 statement `shouldRenderAs` "SELECT * FROM table1 OFFSET (1 + 2);"
71 statement `shouldRenderAs` "SELECT * FROM table1 OFFSET (1 + 2);"
72 it "correctly render simple INSERTs" $ do
72 it "correctly render simple INSERTs" $ do
@@ -84,14 +84,14 @@ spec = do
84 "INSERT INTO students (name) VALUES (E'Robert''); DROP TABLE students;');"
84 "INSERT INTO students (name) VALUES (E'Robert''); DROP TABLE students;');"
85 describe "JOINs" $ do
85 describe "JOINs" $ do
87− vals = project $
87+ vals =
88 #orders .&. #orderVal `As` #orderVal
88 #orders .&. #orderVal `As` #orderVal
89 :& #customers .&. #customerVal `As` #customerVal
89 :& #customers .&. #customerVal `As` #customerVal
90 :& #shippers .&. #shipperVal `As` #shipperVal :& RNil
90 :& #shippers .&. #shipperVal `As` #shipperVal :& RNil
91 it "should render CROSS JOINs" $ do
91 it "should render CROSS JOINs" $ do
93 statement :: Query '[] JoinTables JoinTables ValueColumns
93 statement :: Query '[] JoinTables JoinTables ValueColumns
94− statement = select $ vals & from
94+ statement = select $ vals `from`
95 (tables (#orders & crossJoin #customers & crossJoin #shippers))
95 (tables (#orders & crossJoin #customers & crossJoin #shippers))
96 statement `shouldRenderAs`
96 statement `shouldRenderAs`
@@ -111,7 +111,7 @@ spec = do
111 & innerJoin #shippers
111 & innerJoin #shippers
112 (#orders .&. #shipperID ==* #shippers .&. #shipperID)
112 (#orders .&. #shipperID ==* #shippers .&. #shipperID)
113 selection :: Query '[] JoinTables JoinTables ValueColumns
113 selection :: Query '[] JoinTables JoinTables ValueColumns
114− selection = select $ vals & from innerJoins
114+ selection = select $ vals `from` innerJoins
115 selection `shouldRenderAs`
115 selection `shouldRenderAs`
117 \ orders.orderVal AS orderVal,\
117 \ orders.orderVal AS orderVal,\