Skip to content

Commit 10de081

Browse files
CrsiXWebFreak001
authored andcommitted
Fixed typos and made small improvements in CRUD part
1 parent 6d57ffa commit 10de081

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/rorm/crud.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CRUD
22

3-
To perform database operations, one of the four crud macros is invoked.
3+
To perform database operations, one of the four CRUD macros is invoked.
44

55
They all take an executor as their first argument (i.e. `&Database` or `&mut Transaction`)
66
and the model whose table to interact with as its second argument.
@@ -173,7 +173,7 @@ let posts: Vec<(String, UserWithoutPassword)> =
173173

174174
## Insert
175175

176-
In order to create new rows in the database the insert! macro is used:
176+
In order to create new rows in the database, the `insert!` macro is used:
177177

178178
```rust
179179
#[derive(Patch)]
@@ -269,7 +269,7 @@ pub async fn show_various_returns(db: &Database, user: &NewUser) -> Result<(), E
269269

270270
## Update
271271

272-
In order to models' fields the `update!` macro is used:
272+
In order to change models' fields the `update!` macro is used:
273273

274274
```rust
275275
pub async fn set_good_password(db: &Database) -> Result<(), rorm::Error> {
@@ -283,15 +283,15 @@ pub async fn set_good_password(db: &Database) -> Result<(), rorm::Error> {
283283

284284
### Dynamic mode and `set_if`
285285

286-
Before executing the query `set` has to be called at least once
287-
to set a value to set for a column (The first call changes the builders type).
286+
Before executing the query, `set` has to be called at least once
287+
to set a value for a column (the first call changes the builder's type).
288288
Otherwise the query wouldn't do anything.
289289

290290
This can be limiting when your calls are made conditionally.
291291

292292
To support this, the builder can be put into a "dynamic" mode by calling `begin_dyn_set`.
293293
Then calls to `set` won't change the type.
294-
When you're done use `finish_dyn_set` to go back to "normal" mode.
294+
When you're done, use `finish_dyn_set` to go back to "normal" mode.
295295
It will check the number of "sets" and return `Result` which is `Ok` for at least one and an `Err` for zero.
296296
Both variants contain the builder in "normal" mode to continue.
297297

@@ -382,10 +382,11 @@ To delete a single row, use the `single` method and pass it the model to delete.
382382
`bulk` is used like `single` but takes an iterator of instances and deletes all at once.
383383

384384
### `.condition(...)`
385-
When you need more complex deleting logic than just concrete instance, you can use the `conditon` method.
385+
When you need more complex deleting logic than just some concrete instances,
386+
you can use the `conditon` method.
386387
Any row which matches the provided condition will be deleted.
387388

388389
See [query](crud.md#add-conditions) for how conditions look.
389390

390391
### `all()`
391-
For the case where you'd want to whip the whole table, you can use the `all` method
392+
For the case where you'd want to wipe the whole table, you can use the `all` method.

0 commit comments

Comments
 (0)