mirror of
https://github.com/circuithub/rel8.git
synced 2024-09-11 16:05:41 +03:00
Add a castTable
call to each
If a `Table`'s types line up exactly with Postgres' types, which in they should, then this is a no-op, but if they don't, this makes things a bit safer. In particular, arrays of custom domain types only became possible in Postgres 11. This change makes `some` and `many` somewhat usable on tables containing such types in earlier versions of Postgres.
This commit is contained in:
parent
ae4607aa80
commit
f38f30a2e2
@ -17,16 +17,14 @@ import Rel8.Query ( Query )
|
|||||||
import Rel8.Query.Opaleye ( fromOpaleye )
|
import Rel8.Query.Opaleye ( fromOpaleye )
|
||||||
import Rel8.Schema.Name ( Selects )
|
import Rel8.Schema.Name ( Selects )
|
||||||
import Rel8.Schema.Table ( TableSchema )
|
import Rel8.Schema.Table ( TableSchema )
|
||||||
import Rel8.Table.Cols ( fromCols, toCols )
|
import Rel8.Table.Opaleye ( castTable, table, unpackspec )
|
||||||
import Rel8.Table.Opaleye ( table, unpackspec )
|
|
||||||
|
|
||||||
|
|
||||||
-- | Select each row from a table definition. This is equivalent to @FROM
|
-- | Select each row from a table definition. This is equivalent to @FROM
|
||||||
-- table@.
|
-- table@.
|
||||||
each :: Selects names exprs => TableSchema names -> Query exprs
|
each :: Selects names exprs => TableSchema names -> Query exprs
|
||||||
each =
|
each =
|
||||||
fmap fromCols .
|
fmap castTable .
|
||||||
fromOpaleye .
|
fromOpaleye .
|
||||||
Opaleye.selectTableExplicit unpackspec .
|
Opaleye.selectTableExplicit unpackspec .
|
||||||
table .
|
table
|
||||||
fmap toCols
|
|
||||||
|
Loading…
Reference in New Issue
Block a user