module Database.Beam.Backend.SQL.BeamExtensions
( MonadBeamInsertReturning(..)
, MonadBeamUpdateReturning(..)
, MonadBeamDeleteReturning(..)
, SqlSerial(..)
) where
import Database.Beam.Backend
import Database.Beam.Backend.SQL
import Database.Beam.Query
import Database.Beam.Query.Internal
import Database.Beam.Schema
import Control.Monad.Identity
class MonadBeam syntax be handle m =>
MonadBeamInsertReturning syntax be handle m | m -> syntax be handle, be -> m, handle -> m where
runInsertReturningList
:: ( Beamable table
, Projectible (Sql92ExpressionSyntax syntax) (table (QExpr (Sql92ExpressionSyntax syntax) ()))
, FromBackendRow be (table Identity) )
=> DatabaseEntity be db (TableEntity table)
-> SqlInsertValues (Sql92InsertValuesSyntax (Sql92InsertSyntax syntax))
(table (QExpr (Sql92InsertExpressionSyntax (Sql92InsertSyntax syntax)) s))
-> m [table Identity]
class MonadBeam syntax be handle m =>
MonadBeamUpdateReturning syntax be handle m | m -> syntax be handle, be -> m, handle -> m where
runUpdateReturningList
:: ( Beamable table
, Projectible (Sql92ExpressionSyntax syntax) (table (QExpr (Sql92ExpressionSyntax syntax) ()))
, FromBackendRow be (table Identity) )
=> DatabaseEntity be db (TableEntity table)
-> (forall s. table (QField s) -> [ QAssignment (Sql92UpdateFieldNameSyntax (Sql92UpdateSyntax syntax)) (Sql92UpdateExpressionSyntax (Sql92UpdateSyntax syntax)) s ])
-> (forall s. table (QExpr (Sql92UpdateExpressionSyntax (Sql92UpdateSyntax syntax)) s) -> QExpr (Sql92UpdateExpressionSyntax (Sql92UpdateSyntax syntax)) s Bool)
-> m [table Identity]
class MonadBeam syntax be handle m =>
MonadBeamDeleteReturning syntax be handle m | m -> syntax be handle, be -> m, handle -> m where
runDeleteReturningList
:: ( Beamable table
, Projectible (Sql92ExpressionSyntax syntax) (table (QExpr (Sql92ExpressionSyntax syntax) ()))
, FromBackendRow be (table Identity) )
=> DatabaseEntity be db (TableEntity table)
-> (forall s. table (QExpr (Sql92UpdateExpressionSyntax (Sql92UpdateSyntax syntax)) s) -> QExpr (Sql92UpdateExpressionSyntax (Sql92UpdateSyntax syntax)) s Bool)
-> m [table Identity]