Skip to content

Commit

Permalink
Delete by id (SeaQL/sea-orm#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Mar 25, 2022
1 parent 29961fc commit 0e46179
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions SeaORM/docs/06-basic-crud/05-delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ let res: DeleteResult = orange.delete(db).await?;
assert_eq!(res.rows_affected, 1);
```

## Delete by Primary Key

Instead of selecting `Model` from the database then deleting it. You could also delete a row from database directly by its primary key.

```rust
let res: DeleteResult = Fruit::delete_by_id(38).exec(db).await?;
assert_eq!(res.rows_affected, 1);
```

## Delete Many

You can also delete multiple rows from the database without finding each `Model` with SeaORM select.
Expand Down

0 comments on commit 0e46179

Please sign in to comment.