persistent-sql-lifted-0.4.3.1: Monad classes for running queries with Persistent and Esqueleto
Safe HaskellSafe-Inferred
LanguageGHC2021

Database.Persist.Sql.Lifted.Esqueleto

Description

Wrappers that apply liftSql to Esqueleto utilities of the same name.

Synopsis

Documentation

delete :: forall m. (HasCallStack, MonadSqlBackend m) => SqlQuery () -> m () Source #

Execute an Esqueleto DELETE query

deleteCount Source #

Arguments

:: forall m. (HasCallStack, MonadSqlBackend m) 
=> SqlQuery () 
-> m Int64

The number of rows affected

Execute an Esqueleto DELETE query

deleteKey :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) => Key a -> m () Source #

Delete a specific record by identifier

Does nothing if record does not exist.

insertSelect :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> m () Source #

Insert a PersistField for every selected value

insertSelectCount Source #

Arguments

:: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a) 
=> SqlQuery (SqlExpr (Insertion a)) 
-> m Int64

The number of inserted rows

Insert a PersistField for every selected value, returning the count

renderQueryDelete Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a

SQL query to render

-> m (Text, [PersistValue]) 

Renders a SqlQuery to Text along with the list of PersistValues that would be supplied to the database for ? placeholders

renderQueryInsertInto Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a

SQL query to render

-> m (Text, [PersistValue]) 

Renders a SqlQuery to Text along with the list of PersistValues that would be supplied to the database for ? placeholders

renderQuerySelect Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a

SQL query to render

-> m (Text, [PersistValue]) 

Renders a SqlQuery to Text along with the list of PersistValues that would be supplied to the database for ? placeholders

renderQueryToText Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> Mode

Whether to render as an SELECT, DELETE, etc. You must ensure that the Mode you pass to this function corresponds with the actual SqlQuery. If you pass a query that uses incompatible features (like an INSERT statement with a SELECT mode) then you'll get a weird result.

-> SqlQuery a

SQL query to render

-> m (Text, [PersistValue]) 

Renders a SqlQuery to Text along with the list of PersistValues that would be supplied to the database for ? placeholders

renderQueryUpdate Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a

SQL query to render

-> m (Text, [PersistValue]) 

Renders a SqlQuery to Text along with the list of PersistValues that would be supplied to the database for ? placeholders

select Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a 
-> m [r]

A list of rows

Execute an Esqueleto SELECT query

selectOne Source #

Arguments

:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) 
=> SqlQuery a 
-> m (Maybe r)

The first row, or Nothing if no rows are selected

Execute an Esqueleto SELECT query, getting only the first row

update :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) => (SqlExpr (Entity a) -> SqlQuery ()) -> m () Source #

Execute an Esqueleto UPDATE query

updateCount Source #

Arguments

:: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) 
=> (SqlExpr (Entity a) -> SqlQuery ()) 
-> m Int64

The number of inserted rows

Execute an Esqueleto UPDATE query, returning the count