1{-# language FlexibleContexts #-}
5 , intersect, intersectAll
14import qualified Opaleye.Binary as Opaleye
17import Rel8.Expr ( Expr )
18import {-# SOURCE #-} Rel8.Query ( Query )
19import Rel8.Query.Opaleye ( zipOpaleyeWith )
20import Rel8.Table ( Table )
21import Rel8.Table.Eq ( EqTable )
22import Rel8.Table.Opaleye ( binaryspec )
25-- | Combine the results of two queries of the same type, collapsing
26-- duplicates. @union a b@ is the same as the SQL statement @x UNION b@.
28-- >>> select c $ values [lit True, lit True, lit False] `union` values [lit True]
30union :: EqTable a => Query a -> Query a -> Query a
31union = zipOpaleyeWith (Opaleye.unionExplicit binaryspec)
34-- | Combine the results of two queries of the same type, retaining duplicates.
35-- @unionAll a b@ is the same as the SQL statement @x UNION ALL b@.
37-- >>> select c $ values [lit True, lit True, lit False] `unionAll` values [lit True]
38-- [True,True,False,True]
39unionAll :: Table Expr a => Query a -> Query a -> Query a
40unionAll = zipOpaleyeWith (Opaleye.unionAllExplicit binaryspec)
43-- | Find the intersection of two queries, collapsing duplicates. @intersect a
44-- b@ is the same as the SQL statement @x INTERSECT b@.
46-- >>> select c $ values [lit True, lit True, lit False] `intersect` values [lit True]
48intersect :: EqTable a => Query a -> Query a -> Query a
49intersect = zipOpaleyeWith (Opaleye.intersectExplicit binaryspec)
52-- | Find the intersection of two queries, retaining duplicates. @intersectAll
53-- a b@ is the same as the SQL statement @x INTERSECT ALL b@.
55-- >>> select c $ values [lit True, lit True, lit False] `intersectAll` values [lit True, lit True]
57intersectAll :: EqTable a => Query a -> Query a -> Query a
58intersectAll = zipOpaleyeWith (Opaleye.intersectAllExplicit binaryspec)
61-- | Find the difference of two queries, collapsing duplicates @except a b@ is
62-- the same as the SQL statement @x INTERSECT b@.
64-- >>> select c $ values [lit True, lit False, lit False] `except` values [lit True]
66except :: EqTable a => Query a -> Query a -> Query a
67except = zipOpaleyeWith (Opaleye.exceptExplicit binaryspec)
70-- | Find the difference of two queries, retaining duplicates. @exceptAll a b@
71-- is the same as the SQL statement @x EXCEPT ALL b@.
73-- >>> select c $ values [lit True, lit False, lit False] `exceptAll` values [lit True]
75exceptAll :: Table Expr a => Query a -> Query a -> Query a
76exceptAll = zipOpaleyeWith (Opaleye.exceptAllExplicit binaryspec)
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