on fb4e1a5 help sign in
rel8/src/Rel8/Query/Each.hs
31 lines 669 B history raw
1{-# language FlexibleContexts #-}
3module Rel8.Query.Each
4 ( each
5 )
6where
8-- base
9import Prelude
11-- opaleye
12import qualified Opaleye.Table as Opaleye
14-- rel8
15import Rel8.Query ( Query )
16import Rel8.Query.Opaleye ( fromOpaleye )
17import Rel8.Schema.Name ( Selects )
18import Rel8.Schema.Table ( TableSchema )
19import Rel8.Table ( fromColumns, toColumns )
20import Rel8.Table.Opaleye ( table, unpackspec )
23-- | Select each row from a table definition. This is equivalent to @FROM
24-- table@.
25each :: Selects names exprs => TableSchema names -> Query exprs
26each =
27 fmap fromColumns .
28 fromOpaleye .
29 Opaleye.selectTableExplicit unpackspec .
30 table .
31 fmap toColumns