1{-# options_ghc -fno-warn-redundant-constraints #-}
3module Rel8.Query.Distinct
14import qualified Opaleye.Distinct as Opaleye
15import qualified Opaleye.Internal.Order as Opaleye
16import qualified Opaleye.Internal.QueryArr as Opaleye
19import Rel8.Order ( Order( Order ) )
20import Rel8.Query ( Query )
21import Rel8.Query.Opaleye ( mapOpaleye )
22import Rel8.Table.Eq ( EqTable )
23import Rel8.Table.Opaleye ( distinctspec, unpackspec )
26distinct :: EqTable a => Query a -> Query a
27distinct = mapOpaleye (Opaleye.distinctExplicit distinctspec)
30distinctOn :: EqTable b => (a -> b) -> Query a -> Query a
32 mapOpaleye (\q -> Opaleye.productQueryArr (Opaleye.distinctOn unpackspec proj . Opaleye.runSimpleQueryArr q))
35distinctOnBy :: EqTable b => (a -> b) -> Order a -> Query a -> Query a
36distinctOnBy proj (Order order) =
37 mapOpaleye (\q -> Opaleye.productQueryArr (Opaleye.distinctOnBy unpackspec proj order . Opaleye.runSimpleQueryArr q))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list