Skip to content

Add unsafeSqlCast function#119

Open
potomak wants to merge 1 commit intoprowdsponsor:masterfrom
potomak:unsafe-cast
Open

Add unsafeSqlCast function#119
potomak wants to merge 1 commit intoprowdsponsor:masterfrom
potomak:unsafe-cast

Conversation

@potomak
Copy link

@potomak potomak commented Nov 28, 2015

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

Example usage:

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

See also

It supports a ::<type> cast syntax.

Example usage:

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

See also

* http://www.postgresql.org/docs/9.4/static/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS
* prowdsponsor#54
@meteficha
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants