Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Database.Persist.Sql.Lifted.Esqueleto
Description
Wrappers that apply liftSql
to Esqueleto utilities of the same name.
Synopsis
- delete :: forall m. (HasCallStack, MonadSqlBackend m) => SqlQuery () -> m ()
- deleteCount :: forall m. (HasCallStack, MonadSqlBackend m) => SqlQuery () -> m Int64
- deleteKey :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) => Key a -> m ()
- insertSelect :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> m ()
- insertSelectCount :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a) => SqlQuery (SqlExpr (Insertion a)) -> m Int64
- renderQueryDelete :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m (Text, [PersistValue])
- renderQueryInsertInto :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m (Text, [PersistValue])
- renderQuerySelect :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m (Text, [PersistValue])
- renderQueryToText :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => Mode -> SqlQuery a -> m (Text, [PersistValue])
- renderQueryUpdate :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m (Text, [PersistValue])
- select :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m [r]
- selectOne :: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) => SqlQuery a -> m (Maybe r)
- update :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) => (SqlExpr (Entity a) -> SqlQuery ()) -> m ()
- updateCount :: forall a m. (HasCallStack, MonadSqlBackend m, PersistEntity a, PersistEntityBackend a ~ SqlBackend) => (SqlExpr (Entity a) -> SqlQuery ()) -> m Int64
Documentation
delete :: forall m. (HasCallStack, MonadSqlBackend m) => SqlQuery () -> m () Source #
Execute an Esqueleto DELETE query
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
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
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 PersistValue
s
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 PersistValue
s
that would be supplied to the database for ?
placeholders
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 PersistValue
s
that would be supplied to the database for ?
placeholders
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 PersistValue
s
that would be supplied to the database for ?
placeholders
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 PersistValue
s
that would be supplied to the database for ?
placeholders
Arguments
:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) | |
=> SqlQuery a | |
-> m [r] | A list of rows |
Execute an Esqueleto SELECT query
Arguments
:: forall a r m. (HasCallStack, MonadSqlBackend m, SqlSelect a r) | |
=> SqlQuery a | |
-> m (Maybe r) | The first row, or |
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
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