Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unsafeSqlCast function #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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