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