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

Orville.PostgreSQL.Expr.ValueExpression

Description

Since: 1.0.0.0

Synopsis

Documentation

data ValueExpression Source #

Type to represent an arbitrary value in a SQL expression. This could be a constant value, a column reference or any arbitrary calculated expression. E.G.

(foo + bar) > 20

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

Since: 1.0.0.0

cast :: ValueExpression -> DataType -> ValueExpression Source #

Performs a SQL type cast to the specified type on the given ValueExpression. E.G.

foo :: integer

Since: 1.0.0.0

data ParameterName Source #

Type to represent the name of a name parameter in a PostgreSQL function call. E.G.

foo

in

some_func(foo => 1)

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

Since: 1.0.0.0

columnReference :: ColumnName -> ValueExpression Source #

Uses a ColumnName to reference a column as a ValueExpression. This is the equivalent of simply writing the column name as the expression. E.G.

foo

Since: 1.0.0.0

valueExpression :: SqlValue -> ValueExpression Source #

Uses the given SqlValue as a constant expression. The value will be passed as a statement parameter, not as a literal expression, so there is not need to worry about escaping. However, there are a few places (usually in DDL) where PostgreSQL does not support values passed as parameters where this cannot be used.

Since: 1.0.0.0

rowValueConstructor :: NonEmpty ValueExpression -> ValueExpression Source #

Constructs a PostgreSQL row value expression from the given list of expressions. E.G.

(foo, bar, now())

Since: 1.0.0.0

functionCall :: FunctionName -> [ValueExpression] -> ValueExpression Source #

Constructs a ValueExpression that will call the specified PostgreSQL function with the given arguments passed as position parameters. E.G.

nextval(sequence_name)

Since: 1.0.0.0

functionCallNamedParams :: FunctionName -> [(ParameterName, ValueExpression)] -> ValueExpression Source #

Constructs a ValueExpression that will call the specified PostgreSQL function with the given arguments passed as named parameters. E.G.

make_interval(years => 1)

Since: 1.0.0.0