opaleye-0.7.3.0: An SQL-generating DSL targeting PostgreSQL
Safe HaskellNone
LanguageHaskell2010

Opaleye.Binary

Description

Binary relational operations on Selects, that is, operations which take two Selects as arguments and return a single Select.

All the binary relational operations have the same type specializations. For example:

unionAll :: S.Select (Field a, Field b)
         -> S.Select (Field a, Field b)
         -> S.Select (Field a, Field b)

Assuming the makeAdaptorAndInstance splice has been run for the product type Foo:

unionAll :: S.Select (Foo (Field a) (Field b) (Field c))
         -> S.Select (Foo (Field a) (Field b) (Field c))
         -> S.Select (Foo (Field a) (Field b) (Field c))

If you want to run a binary relational operator on SelectArrs you should apply bilaterally to it, for example

bilaterally union
  :: Default Binaryspec fields fields
  => SelectArr i fields -> SelectArr i fields -> SelectArr i fields

unionAll is very close to being the <|> operator of a Control.Applicative.Alternative instance but it fails to work only because of the typeclass constraint it has.

Synopsis

Binary operations

unionAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

union :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as unionAll, except that it additionally removes any duplicate rows.

intersectAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

intersect :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as intersectAll, except that it additionally removes any duplicate rows.

exceptAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

except :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as exceptAll, except that it additionally removes any duplicate rows.

Explicit versions

unionAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

unionExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

intersectAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

intersectExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

exceptAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

exceptExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

Adaptors