Safe Haskell | None |
---|---|
Language | Haskell2010 |
Some functionality is useful enough to be provided across backends, but is not standardized. For example, many RDBMS systems provide ways of fetching auto-incrementing or defaulting fields on INSERT or UPDATE.
Beam provides type classes that some backends instantiate that provide this support. This uses direct means on sufficiently advanced backends and is emulated on others.
Synopsis
- class MonadBeam be m => MonadBeamInsertReturning be m | m -> be where
- runInsertReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlInsert be table -> m [table Identity]
- class MonadBeam be m => MonadBeamUpdateReturning be m | m -> be where
- runUpdateReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlUpdate be table -> m [table Identity]
- class MonadBeam be m => MonadBeamDeleteReturning be m | m -> be where
- runDeleteReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlDelete be table -> m [table Identity]
- newtype SqlSerial a = SqlSerial {
- unSerial :: a
Documentation
class MonadBeam be m => MonadBeamInsertReturning be m | m -> be where Source #
MonadBeam
s that support returning the newly created rows of an INSERT
statement.
Useful for discovering the real value of a defaulted value.
runInsertReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlInsert be table -> m [table Identity] Source #
Instances
class MonadBeam be m => MonadBeamUpdateReturning be m | m -> be where Source #
MonadBeam
s that support returning the updated rows of an UPDATE
statement.
Useful for discovering the new values of the updated rows.
runUpdateReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlUpdate be table -> m [table Identity] Source #
Instances
class MonadBeam be m => MonadBeamDeleteReturning be m | m -> be where Source #
MonadBeam
s that suppert returning rows that will be deleted by the given
DELETE
statement. Useful for deallocating resources based on the value of
deleted rows.
runDeleteReturningList :: (Beamable table, Projectible be (table (QExpr be ())), FromBackendRow be (table Identity)) => SqlDelete be table -> m [table Identity] Source #