esqueleto-3.0.0: Type-safe EDSL for SQL queries on persistent backends.

Safe HaskellNone
LanguageHaskell2010

Database.Esqueleto.PostgreSQL

Contents

Description

This module contain PostgreSQL-specific functions.

Since: 2.2.8

Synopsis

Documentation

data AggMode Source #

Aggregate mode

Constructors

AggModeAll

ALL

AggModeDistinct

DISTINCT

Instances
Show AggMode Source # 
Instance details

Defined in Database.Esqueleto.PostgreSQL

arrayAggDistinct :: (PersistField a, PersistField [a]) => SqlExpr (Value a) -> SqlExpr (Value (Maybe [a])) Source #

(array_agg) Concatenate distinct input values, including NULLs, into an array.

Since: 2.5.3

arrayRemove :: SqlExpr (Value [a]) -> SqlExpr (Value a) -> SqlExpr (Value [a]) Source #

(array_remove) Remove all elements equal to the given value from the array.

Since: 2.5.3

arrayRemoveNull :: SqlExpr (Value [Maybe a]) -> SqlExpr (Value [a]) Source #

Remove NULL values from an array

stringAgg Source #

Arguments

:: SqlString s 
=> SqlExpr (Value s)

Input values.

-> SqlExpr (Value s)

Delimiter.

-> SqlExpr (Value (Maybe s))

Concatenation.

(string_agg) Concatenate input values separated by a delimiter.

Since: 2.2.8

stringAggWith Source #

Arguments

:: SqlString s 
=> AggMode

Aggregate mode (ALL or DISTINCT)

-> SqlExpr (Value s)

Input values.

-> SqlExpr (Value s)

Delimiter.

-> [OrderByClause]

ORDER BY clauses

-> SqlExpr (Value (Maybe s))

Concatenation.

(string_agg) Concatenate input values separated by a delimiter.

maybeArray :: (PersistField a, PersistField [a]) => SqlExpr (Value (Maybe [a])) -> SqlExpr (Value [a]) Source #

Coalesce an array with an empty default value

chr :: SqlString s => SqlExpr (Value Int) -> SqlExpr (Value s) Source #

(chr) Translate the given integer to a character. (Note the result will depend on the character set of your database.)

Since: 2.2.11

random_ :: (PersistField a, Num a) => SqlExpr (Value a) Source #

(random()) Split out into database specific modules because MySQL uses `rand()`.

Since: 2.6.0

Internal

unsafeSqlAggregateFunction :: UnsafeSqlFunctionArgument a => Builder -> AggMode -> a -> [OrderByClause] -> SqlExpr (Value b) Source #

(Internal) Create a custom aggregate functions with aggregate mode

Do not use this function directly, instead define a new function and give it a type (see unsafeSqlBinOp)