Skip to content

Commit

Permalink
Fix doc typos
Browse files Browse the repository at this point in the history
  • Loading branch information
levkk committed Dec 2, 2024
1 parent cac2a9d commit 012e5bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/docs/models/connection-pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Returning the connection to the pool is done automatically when the `conn` varia
```rust
let users = {
let mut conn = Pool::connection().await?;
let users = User::all()
User::all()
.fetch_all(&mut conn)
.await?
};
```

## Transactions

All queries are executed inside implicit transactions. If you need to execute multiple queries inside a single transaction, you need to start one explicitly:
All queries are executed inside their own implicit transactions by default. If you need to execute multiple queries inside a single transaction, you need to start one explicitly:

```rust
let mut transaction = Pool::transaction().await?;
Expand All @@ -58,4 +58,4 @@ let user = User::find(15)

## Waiting for connections

When all available connections are checked out, the call to `Pool::connection()` will wait (and asynchronously block) until a connection is returned to the pool. If a connection is not returned in time, an timeout error will be returned, unblocking the request and allowing it to handle the situation gracefully.
When all available connections are checked out, the call to `Pool::connection()` will wait (and asynchronously block) until a connection is returned to the pool. If a connection is not returned in time, a timeout error will be returned, unblocking the request and allowing it to handle the situation gracefully.
4 changes: 2 additions & 2 deletions docs/docs/models/fetch-records.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ accessed while you're doing something to it, for example updating it with new va
transaction.commit().await?;
```
=== "SQL"
```
```postgresql
BEGIN;
SELECT * FRON "users" WHERE "id" = $1 FOR UPDATE;
COMMIT;
```


The lock on the row(s) returned by a query last only for the duration of the transaction. It's common to use that time to update multiple tables that have some kind of
relationship to the row being locked. This mechanism allows to perform atomic operations (all or nothing) in a concurrent environment without data races or inconsistencies.
relationship to the row being locked. This mechanism allows to perform atomic operations (all or nothing) in a concurrent environment without data races or inconsistencies.

0 comments on commit 012e5bb

Please sign in to comment.