New SqlEntity constraint synonym.

This commit is contained in:
Felipe Lessa 2012-09-09 09:47:38 -03:00
parent 6431bcc91f
commit 0aa3c23a75
2 changed files with 8 additions and 2 deletions

View File

@ -38,6 +38,7 @@ module Database.Esqueleto
-- * SQL backend -- * SQL backend
, SqlQuery , SqlQuery
, SqlExpr , SqlExpr
, SqlEntity
, select , select
, selectDistinct , selectDistinct
, selectSource , selectSource

View File

@ -14,6 +14,7 @@ module Database.Esqueleto.Internal.Sql
( -- * The pretty face ( -- * The pretty face
SqlQuery SqlQuery
, SqlExpr , SqlExpr
, SqlEntity
, select , select
, selectSource , selectSource
, selectDistinct , selectDistinct
@ -74,6 +75,11 @@ instance Applicative SqlQuery where
(<*>) = ap (<*>) = ap
-- | Constraint synonym for @persistent@ entities whose backend
-- is 'SqlPersist'.
type SqlEntity ent = (PersistEntity ent, PersistEntityBackend ent ~ SqlPersist)
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -498,8 +504,7 @@ delete = rawExecute DELETE
-- @ -- @
update :: ( MonadLogger m update :: ( MonadLogger m
, MonadResourceBase m , MonadResourceBase m
, PersistEntity val , SqlEntity val )
, PersistEntityBackend val ~ SqlPersist )
=> (SqlExpr (Entity val) -> SqlQuery ()) => (SqlExpr (Entity val) -> SqlQuery ())
-> SqlPersist m () -> SqlPersist m ()
update = rawExecute UPDATE . from update = rawExecute UPDATE . from