orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Expr.WhereClause

Description

Since: 1.0.0.0

Synopsis

Documentation

data WhereClause Source #

Type to represent a WHERE clause restriction on a SELECT, UPDATE or DELETE statement. E.G.

WHERE (foo > 10)

WhereClause provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

whereClause :: BooleanExpr -> WhereClause Source #

Constructs a WHERE clause from the given BooleanExpr. E.G.

WHERE <boolean expr>

Since: 1.0.0.0

data BooleanExpr Source #

Type to represent a SQL value expression that evaluates to a boolean and therefore can used with boolean logic functions. E.G.

foo > 10

BooleanExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

literalBooleanExpr :: Bool -> BooleanExpr Source #

Constructs a BooleanExpr whose value is the SQL literal TRUE or FALSE depending on the argument given.

Since: 1.0.0.0

andExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr Source #

The SQL AND operator. The arguments will be surrounded with parentheses to ensure that the associativity of expression in the resulting SQL matches the associativity implied by this Haskell function.

Since: 1.0.0.0

(.&&) :: BooleanExpr -> BooleanExpr -> BooleanExpr infixr 8 Source #

The SQL AND operator (alias for andExpr).

Since: 1.0.0.0

orExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr Source #

The SQL OR operator. The arguments will be surrounded with parentheses to ensure that the associativity of expression in the resulting SQL matches the associativity implied by this Haskell function.

Since: 1.0.0.0

(.||) :: BooleanExpr -> BooleanExpr -> BooleanExpr infixr 8 Source #

The SQL OR operator (alias for orExpr).

Since: 1.0.0.0

parenthesized :: BooleanExpr -> BooleanExpr Source #

Surrounds the given BooleanExpr with parentheses.

Since: 1.0.0.0

equals :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL = operator.

Since: 1.0.0.0

notEquals :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL <> operator.

Since: 1.0.0.0

greaterThan :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL > operator.

Since: 1.0.0.0

lessThan :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL < operator.

Since: 1.0.0.0

greaterThanOrEqualTo :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL >= operator.

Since: 1.0.0.0

lessThanOrEqualTo :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL <= operator.

Since: 1.0.0.0

like :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL LIKE operator.

Since: 1.0.0.0

likeInsensitive :: ValueExpression -> ValueExpression -> BooleanExpr Source #

The SQL ILIKE operator.

Since: 1.0.0.0

isNull :: ValueExpression -> BooleanExpr Source #

The SQL IS NULL condition.

Since: 1.0.0.0

isNotNull :: ValueExpression -> BooleanExpr Source #

The SQL IS NOT NULL condition.

Since: 1.0.0.0

valueIn :: ValueExpression -> NonEmpty ValueExpression -> BooleanExpr Source #

The SQL IN operator. The result will be TRUE if the given value appears in the list of values given.

Since: 1.0.0.0

valueNotIn :: ValueExpression -> NonEmpty ValueExpression -> BooleanExpr Source #

The SQL NOT IN operator. The result will be TRUE if the given value does not appear in the list of values given.

Since: 1.0.0.0

tupleIn :: NonEmpty ValueExpression -> NonEmpty (NonEmpty ValueExpression) -> BooleanExpr Source #

The SQL IN operator, like valueIn, but for when you want to construct a tuple in SQL and check if it is in a list of tuples. It is up to the caller to ensure that all the tuples given have the same arity.

Since: 1.0.0.0

tupleNotIn :: NonEmpty ValueExpression -> NonEmpty (NonEmpty ValueExpression) -> BooleanExpr Source #

The SQL NOT IN operator, like valueNotIn, but for when you want to construct a tuple in SQL and check if it is not in a list of tuples. It is up to the caller to ensure that all the tuples given have the same arity.

Since: 1.0.0.0

data InValuePredicate Source #

Type to represent the right hand side of an IN or NOT IN expression. E.G.

(10,12,13)

InValuePredicate provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

inPredicate :: ValueExpression -> InValuePredicate -> BooleanExpr Source #

Lower-level access to the SQL IN operator. This takes any ValueExpression and InValuePredicate. It is up to the caller to ensure the expressions given make sense together.

Since: 1.0.0.0

notInPredicate :: ValueExpression -> InValuePredicate -> BooleanExpr Source #

Lower-level access to the SQL NOT IN operator. This takes any ValueExpression and InValuePredicate. It is up to the caller to ensure the expressions given make sense together.

Since: 1.0.0.0

inValueList :: NonEmpty ValueExpression -> InValuePredicate Source #

Constructs an InValuePredicate from the given list of ValueExpression.

Since: 1.0.0.0