Closed joeyh closed 10 years ago
Value :: typ -> Value typ
val :: PersistField typ => typ -> expr (Value typ)
Everything is working as expected. Value
is just a newtype
used to tag values and distinguish them from Entitiy
s. OTOH, val
does a lot more by creating an expression.
On most cases you should unpack the Value
as soon as you get it.
Can't use an existing Value in a delete where_
I found the test case below very confusing. As far as I could tell, the select query returned a Value Key, which should have been the type needed in the delete where_.
However this caused a error:
The fix seems to be to unpack the Value, and re-pack it with val inside the where_ clause. (Specifically, replace the first k2 with Value k2, and the second k2 with val k2.)
Am I missing something in the documentation that explains how to do this, or is the inability to unify these types a bug?