on dev help sign in
nomenclature
532ce01Eitan Chatav
squeel-postgresql/src/Squeel/PostgreSQL/Statement.hs+17−17
@@ -306,17 +306,17 @@ instance OrdB (Expression params tables (optionality ('NotNull ty))) where
306table expressions
306table expressions
307-----------------------------------------}
307-----------------------------------------}
308
308
309−newtype TableExpression
309+newtype Table
310 (params :: [ColumnType])
310 (params :: [ColumnType])
311 (schema :: [(Symbol,[(Symbol,ColumnType)])])
311 (schema :: [(Symbol,[(Symbol,ColumnType)])])
312 (columns :: [(Symbol,ColumnType)])
312 (columns :: [(Symbol,ColumnType)])
313− = UnsafeTableExpression { renderTableExpression :: ByteString }
313+ = UnsafeTable { renderTable :: ByteString }
314 deriving (Show,Eq)
314 deriving (Show,Eq)
315
315
316class KnownSymbol table => HasTable table tables columns
316class KnownSymbol table => HasTable table tables columns
317 | table tables -> columns where
317 | table tables -> columns where
318− getTable :: Proxy# table -> TableExpression params tables columns
318+ getTable :: Proxy# table -> Table params tables columns
319− getTable table = UnsafeTableExpression $ fromString $ symbolVal' table
319+ getTable table = UnsafeTable $ fromString $ symbolVal' table
320instance {-# OVERLAPPING #-} KnownSymbol table
320instance {-# OVERLAPPING #-} KnownSymbol table
321 => HasTable table ((table ::: columns) ': tables) columns
321 => HasTable table ((table ::: columns) ': tables) columns
322instance {-# OVERLAPPABLE #-}
322instance {-# OVERLAPPABLE #-}
@@ -324,7 +324,7 @@ instance {-# OVERLAPPABLE #-}
324 => HasTable table (table' ': schema) columns
324 => HasTable table (table' ': schema) columns
325
325
326instance HasTable table schema columns
326instance HasTable table schema columns
327− => IsLabel table (TableExpression params schema columns) where
327+ => IsLabel table (Table params schema columns) where
328 fromLabel = getTable
328 fromLabel = getTable
329
329
330{-----------------------------------------
330{-----------------------------------------
@@ -353,32 +353,32 @@ SELECT statements
353
353
354data Join params schema tables where
354data Join params schema tables where
355 Table
355 Table
356− :: Aliased (TableExpression params schema) table
356+ :: Aliased (Table params schema) table
357 -> Join params schema '[table]
357 -> Join params schema '[table]
358 Subselect
358 Subselect
359 :: Aliased (Selection params schema) table
359 :: Aliased (Selection params schema) table
360 -> Join params schema '[table]
360 -> Join params schema '[table]
361 Cross
361 Cross
362− :: Aliased (TableExpression params schema) table
362+ :: Aliased (Table params schema) table
363 -> Join params schema tables
363 -> Join params schema tables
364 -> Join params schema (table ': tables)
364 -> Join params schema (table ': tables)
365 Inner
365 Inner
366− :: Aliased (TableExpression params schema) table
366+ :: Aliased (Table params schema) table
367 -> Expression params (table ': tables) ('Required ('NotNull 'PGBool))
367 -> Expression params (table ': tables) ('Required ('NotNull 'PGBool))
368 -> Join params schema tables
368 -> Join params schema tables
369 -> Join params schema (table ': tables)
369 -> Join params schema (table ': tables)
370 LeftOuter
370 LeftOuter
371− :: Aliased (TableExpression params schema) right
371+ :: Aliased (Table params schema) right
372 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
372 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
373 -> Join params schema (tables)
373 -> Join params schema (tables)
374 -> Join params schema (NullifyTable right ': left ': tables)
374 -> Join params schema (NullifyTable right ': left ': tables)
375 RightOuter
375 RightOuter
376− :: Aliased (TableExpression params schema) right
376+ :: Aliased (Table params schema) right
377 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
377 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
378 -> Join params schema (left : tables)
378 -> Join params schema (left : tables)
379 -> Join params schema (right ': NullifyTable left ': tables)
379 -> Join params schema (right ': NullifyTable left ': tables)
380 FullOuter
380 FullOuter
381− :: Aliased (TableExpression params schema) right
381+ :: Aliased (Table params schema) right
382 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
382 -> Expression params '[left,right] ('Required ('NotNull 'PGBool))
383 -> Join params schema (left : tables)
383 -> Join params schema (left : tables)
384 -> Join params schema
384 -> Join params schema
@@ -386,38 +386,38 @@ data Join params schema tables where
386
386
387renderJoin :: Join params schema tables -> ByteString
387renderJoin :: Join params schema tables -> ByteString
388renderJoin = \case
388renderJoin = \case
389− Table table -> renderAliased renderTableExpression table
389+ Table table -> renderAliased renderTable table
390 Subselect selection -> "SELECT " <> renderAliased renderSelection selection
390 Subselect selection -> "SELECT " <> renderAliased renderSelection selection
391 Cross table tables -> mconcat
391 Cross table tables -> mconcat
392 [ renderJoin tables
392 [ renderJoin tables
393 , " CROSS JOIN "
393 , " CROSS JOIN "
394− , renderAliased renderTableExpression table
394+ , renderAliased renderTable table
395 ]
395 ]
396 Inner table on tables -> mconcat
396 Inner table on tables -> mconcat
397 [ renderJoin tables
397 [ renderJoin tables
398 , " INNER JOIN "
398 , " INNER JOIN "
399− , renderAliased renderTableExpression table
399+ , renderAliased renderTable table
400 , " ON "
400 , " ON "
401 , renderExpression on
401 , renderExpression on
402 ]
402 ]
403 LeftOuter table on tables -> mconcat
403 LeftOuter table on tables -> mconcat
404 [ renderJoin tables
404 [ renderJoin tables
405 , " LEFT OUTER JOIN "
405 , " LEFT OUTER JOIN "
406− , renderAliased renderTableExpression table
406+ , renderAliased renderTable table
407 , " ON "
407 , " ON "
408 , renderExpression on
408 , renderExpression on
409 ]
409 ]
410 RightOuter table on tables -> mconcat
410 RightOuter table on tables -> mconcat
411 [ renderJoin tables
411 [ renderJoin tables
412 , " RIGHT OUTER JOIN "
412 , " RIGHT OUTER JOIN "
413− , renderAliased renderTableExpression table
413+ , renderAliased renderTable table
414 , " ON "
414 , " ON "
415 , renderExpression on
415 , renderExpression on
416 ]
416 ]
417 FullOuter table on tables -> mconcat
417 FullOuter table on tables -> mconcat
418 [ renderJoin tables
418 [ renderJoin tables
419 , " FULL OUTER JOIN "
419 , " FULL OUTER JOIN "
420− , renderAliased renderTableExpression table
420+ , renderAliased renderTable table
421 , " ON "
421 , " ON "
422 , renderExpression on
422 , renderExpression on
423 ]
423 ]