Merge pull request #69 from erikd/master

Add function valJ (was keyE).
This commit is contained in:
Felipe Lessa 2014-07-07 23:54:19 -03:00
commit 655ff7c1c0

View File

@ -81,6 +81,7 @@ module Database.Esqueleto
-- * Helpers
, valkey
, valJ
-- * Re-exports
-- $reexports
@ -376,6 +377,18 @@ valkey :: Esqueleto query expr backend =>
valkey = val . Key . PersistInt64
-- | @valJ@ is like @val@ but for something that is already a @Value@. The use
-- case it was written for was, given a @Value@ lift the @Key@ for that @Value@
-- into the query expression in a type safe way. However, the implementation is
-- more generic than that so we call it @valJ@.
-- Its important to note that the input entity and the output entity are
-- constrained to be the same by the type signature on the function.
-- (<https://github.com/prowdsponsor/esqueleto/pull/69>)
valJ :: Esqueleto query expr backend =>
Value (Key entity) -> expr (Value (Key entity))
valJ = val . unValue
----------------------------------------------------------------------