opaleye-0.6.1.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell2010

Opaleye.Binary

Contents

Description

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

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

unionAll :: Query (Column a, Column b)
         -> Query (Column a, Column b)
         -> Query (Column a, Column b)

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

unionAll :: Query (Foo (Column a) (Column b) (Column c))
         -> Query (Foo (Column a) (Column b) (Column c))
         -> Query (Foo (Column a) (Column b) (Column c))

Please note that by design there are no binary relational functions of type QueryArr a b -> QueryArr a b -> QueryArr a b. Such functions would allow violation of SQL's scoping rules and lead to invalid queries.

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 columns columns => Query columns -> Query columns -> Query columns Source #

union :: Default Binaryspec columns columns => Query columns -> Query columns -> Query columns Source #

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

intersectAll :: Default Binaryspec columns columns => Query columns -> Query columns -> Query columns Source #

intersect :: Default Binaryspec columns columns => Query columns -> Query columns -> Query columns Source #

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

exceptAll :: Default Binaryspec columns columns => Query columns -> Query columns -> Query columns Source #

except :: Default Binaryspec columns columns => Query columns -> Query columns -> Query columns Source #

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

Explicit versions

unionAllExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #

unionExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #

intersectAllExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #

intersectExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #

exceptAllExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #

exceptExplicit :: Binaryspec columns columns' -> Query columns -> Query columns -> Query columns' Source #