Add valkey helper (fixes #9).
This commit is contained in:
parent
e5e5476683
commit
aa2c207dd1
@ -50,6 +50,9 @@ module Database.Esqueleto
|
|||||||
, delete
|
, delete
|
||||||
, update
|
, update
|
||||||
|
|
||||||
|
-- * Helpers
|
||||||
|
, valkey
|
||||||
|
|
||||||
-- * Re-exports
|
-- * Re-exports
|
||||||
-- $reexports
|
-- $reexports
|
||||||
, deleteKey
|
, deleteKey
|
||||||
@ -57,6 +60,7 @@ module Database.Esqueleto
|
|||||||
, module Database.Persist.Store
|
, module Database.Persist.Store
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Int (Int64)
|
||||||
import Database.Esqueleto.Internal.Language
|
import Database.Esqueleto.Internal.Language
|
||||||
import Database.Esqueleto.Internal.Sql
|
import Database.Esqueleto.Internal.Sql
|
||||||
import Database.Persist.Store hiding (delete)
|
import Database.Persist.Store hiding (delete)
|
||||||
@ -294,6 +298,16 @@ import qualified Database.Persist.Store
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
-- | @valkey i = val (Key (PersistInt64 i))@
|
||||||
|
-- (<https://github.com/meteficha/esqueleto/issues/9>).
|
||||||
|
valkey :: Esqueleto query expr backend =>
|
||||||
|
Int64 -> expr (Value (Key entity))
|
||||||
|
valkey = val . Key . PersistInt64
|
||||||
|
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
-- | Synonym for 'Database.Persist.Store.delete' that does not
|
-- | Synonym for 'Database.Persist.Store.delete' that does not
|
||||||
-- clash with @esqueleto@'s 'delete'.
|
-- clash with @esqueleto@'s 'delete'.
|
||||||
deleteKey :: ( PersistStore m
|
deleteKey :: ( PersistStore m
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user