opaleye-0.5.2.2: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell2010

Opaleye.Join

Contents

Description

Left, right, and full outer joins.

Opaleye.FunctionalJoin provides a much nicer, Haskelly, interface to joins than this module, which sticks to the (horrible) standard "make missing rows NULL" interface that SQL provides.

If you want inner joins, just use restrict instead.

The use of the Default typeclass means that the compiler will have trouble inferring types. It is strongly recommended that you provide full type signatures when using the join functions.

Example specialization:

leftJoin :: Query (Column a, Column b)
         -> Query (Column c, Column (Nullable d))
         -> (((Column a, Column b), (Column c, Column (Nullable d))) -> Column PGBool)
         -> Query ((Column a, Column b), (Column (Nullable c), Column (Nullable d)))

Synopsis

Joins

leftJoin Source #

Arguments

:: (Default Unpackspec columnsL columnsL, Default Unpackspec columnsR columnsR, Default NullMaker columnsR nullableColumnsR) 
=> Query columnsL

Left query

-> Query columnsR

Right query

-> ((columnsL, columnsR) -> Column PGBool)

Condition on which to join

-> Query (columnsL, nullableColumnsR)

Left join

rightJoin Source #

Arguments

:: (Default Unpackspec columnsL columnsL, Default Unpackspec columnsR columnsR, Default NullMaker columnsL nullableColumnsL) 
=> Query columnsL

Left query

-> Query columnsR

Right query

-> ((columnsL, columnsR) -> Column PGBool)

Condition on which to join

-> Query (nullableColumnsL, columnsR)

Right join

fullJoin Source #

Arguments

:: (Default Unpackspec columnsL columnsL, Default Unpackspec columnsR columnsR, Default NullMaker columnsL nullableColumnsL, Default NullMaker columnsR nullableColumnsR) 
=> Query columnsL

Left query

-> Query columnsR

Right query

-> ((columnsL, columnsR) -> Column PGBool)

Condition on which to join

-> Query (nullableColumnsL, nullableColumnsR)

Full outer join

Explicit versions

leftJoinExplicit :: Unpackspec columnsL columnsL -> Unpackspec columnsR columnsR -> NullMaker columnsR nullableColumnsR -> Query columnsL -> Query columnsR -> ((columnsL, columnsR) -> Column PGBool) -> Query (columnsL, nullableColumnsR) Source #

rightJoinExplicit :: Unpackspec columnsL columnsL -> Unpackspec columnsR columnsR -> NullMaker columnsL nullableColumnsL -> Query columnsL -> Query columnsR -> ((columnsL, columnsR) -> Column PGBool) -> Query (nullableColumnsL, columnsR) Source #

fullJoinExplicit :: Unpackspec columnsL columnsL -> Unpackspec columnsR columnsR -> NullMaker columnsL nullableColumnsL -> NullMaker columnsR nullableColumnsR -> Query columnsL -> Query columnsR -> ((columnsL, columnsR) -> Column PGBool) -> Query (nullableColumnsL, nullableColumnsR) Source #