opaleye-0.5.0.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell98

Opaleye.Operators

Description

Operators on Columns. Numeric Column types are instances of Num, so you can use *, /, +, - on them.

Synopsis

Documentation

restrict :: QueryArr (Column PGBool) () Source

Restrict query results to a particular condition. Corresponds to the guard method of the MonadPlus class. You would typically use restrict if you want to use Arrow notation.

keepWhen :: (a -> Column PGBool) -> QueryArr a a Source

Filter a QueryArr to only those rows where the given condition holds. This is the QueryArr equivalent of filter from the Prelude. You would typically use keepWhen if you want to use a "point free" style.

(.==) :: Column a -> Column a -> Column PGBool infix 4 Source

(./=) :: Column a -> Column a -> Column PGBool infix 4 Source

(.===) :: Default EqPP columns columns => columns -> columns -> Column PGBool infix 4 Source

A polymorphic equality operator that works for all types that you have run makeAdaptorAndInstance on. This may be unified with .== in a future version.

(./==) :: Default EqPP columns columns => columns -> columns -> Column PGBool infix 4 Source

A polymorphic inequality operator that works for all types that you have run makeAdaptorAndInstance on. This may be unified with .== in a future version.

(.>) :: PGOrd a => Column a -> Column a -> Column PGBool infix 4 Source

(.<) :: PGOrd a => Column a -> Column a -> Column PGBool infix 4 Source

(.<=) :: PGOrd a => Column a -> Column a -> Column PGBool infix 4 Source

(.>=) :: PGOrd a => Column a -> Column a -> Column PGBool infix 4 Source

ors :: Foldable f => f (Column PGBool) -> Column PGBool Source

True when any element of the container is true

in_ :: (Functor f, Foldable f) => f (Column a) -> Column a -> Column PGBool Source

inQuery :: Default EqPP columns columns => columns -> QueryArr () columns -> Query (Column PGBool) Source

True if the first argument occurs amongst the rows of the second, false otherwise.

This operation is equivalent to Postgres's IN operator but, for expediency, is currently implemented using a LEFT JOIN. Please file a bug if this causes any issues in practice.