Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contain PostgreSQL-specific functions.
Since: 2.2.8
Synopsis
- data AggMode
- arrayAggDistinct :: (PersistField a, PersistField [a]) => SqlExpr (Value a) -> SqlExpr (Value (Maybe [a]))
- arrayAgg :: PersistField a => SqlExpr (Value a) -> SqlExpr (Value (Maybe [a]))
- arrayAggWith :: AggMode -> SqlExpr (Value a) -> [OrderByClause] -> SqlExpr (Value (Maybe [a]))
- arrayRemove :: SqlExpr (Value [a]) -> SqlExpr (Value a) -> SqlExpr (Value [a])
- arrayRemoveNull :: SqlExpr (Value [Maybe a]) -> SqlExpr (Value [a])
- stringAgg :: SqlString s => SqlExpr (Value s) -> SqlExpr (Value s) -> SqlExpr (Value (Maybe s))
- stringAggWith :: SqlString s => AggMode -> SqlExpr (Value s) -> SqlExpr (Value s) -> [OrderByClause] -> SqlExpr (Value (Maybe s))
- maybeArray :: (PersistField a, PersistField [a]) => SqlExpr (Value (Maybe [a])) -> SqlExpr (Value [a])
- chr :: SqlString s => SqlExpr (Value Int) -> SqlExpr (Value s)
- now_ :: SqlExpr (Value UTCTime)
- random_ :: (PersistField a, Num a) => SqlExpr (Value a)
- unsafeSqlAggregateFunction :: UnsafeSqlFunctionArgument a => Builder -> AggMode -> a -> [OrderByClause] -> SqlExpr (Value b)
Documentation
Aggregate mode
AggModeAll | ALL |
AggModeDistinct | DISTINCT |
arrayAggDistinct :: (PersistField a, PersistField [a]) => SqlExpr (Value a) -> SqlExpr (Value (Maybe [a])) Source #
(array_agg
) Concatenate distinct input values, including NULL
s, into
an array.
Since: 2.5.3
arrayAggWith :: AggMode -> SqlExpr (Value a) -> [OrderByClause] -> SqlExpr (Value (Maybe [a])) Source #
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
:: 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
:: 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
)