prowdsponsor / esqueleto

Bare bones, type-safe EDSL for SQL queries on persistent backends.
http://hackage.haskell.org/package/esqueleto
BSD 3-Clause "New" or "Revised" License
177 stars 51 forks source link

Add unsafeSqlCast function #119

Open potomak opened 8 years ago

potomak commented 8 years ago

It supports a <exp>::<type> cast syntax.

Example usage:

castToNumeric :: UnsafeSqlFunctionArgument a => a -> SqlExpr (Value PersistValue)
castToNumeric = unsafeSqlCast "numeric"

See also

meteficha commented 8 years ago

It's unclear to me how unsafeSqlCast is going to behave when given an argument that toArgList converts to a list with more than one element. Please add unit tests to make sure it works as intended.

Also, can you copy-paste your example into the Haddock? It will help people a lot when looking at this function :). And please add /Since: 2.4.2/ as well.