Skip to content

Commit

Permalink
Improved documentation formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Jan 24, 2022
1 parent dc0cdb0 commit 315f50a
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions Guide/database.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,21 @@ do
deleteRecord user
```
Or pass only the ID with `[`deleteRecordById`](https://ihp.digitallyinduced.com/api-docs/IHP-ModelSupport.html#v:deleteRecordById).
This will execute:
```sql
DELETE FROM users WHERE id = "cf633b17-c409-4df5-a2fc-8c3b3d6c2ea7"
```
### Deleting a single record by id
If you only know a record's id, use [`deleteRecordById`](https://ihp.digitallyinduced.com/api-docs/IHP-ModelSupport.html#v:deleteRecord) to run a simple `DELETE` query:
```haskell
do
let userId = ("cf633b17-c409-4df5-a2fc-8c3b3d6c2ea7" :: Id User)
deleteRecordBy userId
```
This will execute:
Expand All @@ -585,7 +599,23 @@ do
deleteRecords users
```
Or pass only the ID with `[`deleteRecordByIds`](https://ihp.digitallyinduced.com/api-docs/IHP-ModelSupport.html#v:deleteRecordByIds).
This will execute:
```sql
DELETE FROM users WHERE id IN (...)
```
### Deleting many records by their ids
If you only know the record ids, use [`deleteRecordByIds`](https://ihp.digitallyinduced.com/api-docs/IHP-ModelSupport.html#v:deleteRecords) to run a `DELETE` query for multiple records:
```haskell
do
userIds :: [Id User] <- ...
deleteRecordByIds userIds
```
This will execute:
Expand Down

0 comments on commit 315f50a

Please sign in to comment.