Skip to content

Commit a362360

Browse files
committed
chore: fix docs formatting
1 parent a16967f commit a362360

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

docs/README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ of search parameters such as the following:
132132
#### Password encoding
133133

134134
One thing that must be taken into consideration is that passwords contained
135-
inside the URL must be properly encoded to be passed down to the
136-
database. You can achieve that by using the JavaScript API `encodeURIComponent`
137-
and passing your password as an argument.
135+
inside the URL must be properly encoded to be passed down to the database. You
136+
can achieve that by using the JavaScript API `encodeURIComponent` and passing
137+
your password as an argument.
138138

139139
**Invalid**:
140140

@@ -147,8 +147,8 @@ and passing your password as an argument.
147147
- `postgres://me:p%C3%A1ssword!%3Dwith_symbols@localhost:5432/my_database`
148148

149149
If the password is not encoded correctly, the driver will try to pass the raw
150-
password to the database, however, it's highly recommended that all passwords are
151-
always encoded to prevent authentication errors
150+
password to the database, however, it's highly recommended that all passwords
151+
are always encoded to prevent authentication errors
152152

153153
### Database reconnection
154154

@@ -175,8 +175,8 @@ try {
175175
await client.queryArray`SELECT 1`;
176176
```
177177

178-
If automatic reconnection is not desired, the developer can set the
179-
number of attempts to zero and manage connection and reconnection manually
178+
If automatic reconnection is not desired, the developer can set the number of
179+
attempts to zero and manage connection and reconnection manually
180180

181181
```ts
182182
const client = new Client({
@@ -597,9 +597,9 @@ replaced at runtime with an argument object
597597
}
598598
```
599599

600-
Behind the scenes, `deno-postgres` will replace the variable names in your
601-
query for Postgres-readable placeholders making it easy to reuse values in
602-
multiple places in your query
600+
Behind the scenes, `deno-postgres` will replace the variable names in your query
601+
for Postgres-readable placeholders making it easy to reuse values in multiple
602+
places in your query
603603

604604
```ts
605605
{
@@ -653,11 +653,11 @@ intended
653653

654654
#### Regarding non-argument parameters
655655

656-
A common assumption many people make when working with prepared statements is that
657-
they work the same way string interpolation works, by replacing the placeholders
658-
with whatever variables have been passed down to the query. However the reality
659-
is a little more complicated than that where only very specific parts of a query
660-
can use placeholders to indicate upcoming values
656+
A common assumption many people make when working with prepared statements is
657+
that they work the same way string interpolation works, by replacing the
658+
placeholders with whatever variables have been passed down to the query. However
659+
the reality is a little more complicated than that where only very specific
660+
parts of a query can use placeholders to indicate upcoming values
661661

662662
That's the reason why the following works
663663

@@ -949,8 +949,8 @@ Other aspects to take into account when using the `fields` argument:
949949

950950
A lot of effort was put into abstracting Transactions in the library, and the
951951
final result is an API that is both simple to use and offers all of the options
952-
and features that you would get by executing SQL statements, plus an extra
953-
layer of abstraction that helps you catch mistakes ahead of time.
952+
and features that you would get by executing SQL statements, plus an extra layer
953+
of abstraction that helps you catch mistakes ahead of time.
954954

955955
#### Creating a transaction
956956

@@ -977,8 +977,8 @@ Due to how SQL transactions work, every time you begin a transaction all queries
977977
you do in your session will run inside that transaction context. This is a
978978
problem for query execution since it might cause queries that are meant to do
979979
persistent changes to the database to live inside this context, making them
980-
susceptible to being rolled back unintentionally. We will call this kind of queries
981-
**unsafe operations**.
980+
susceptible to being rolled back unintentionally. We will call this kind of
981+
queries **unsafe operations**.
982982

983983
Every time you create a transaction the client you use will get a lock, with the
984984
purpose of blocking any external queries from running while a transaction takes
@@ -1001,9 +1001,9 @@ await client.queryArray`DELETE TABLE X`;
10011001
For this very reason, however, if you are using transactions in an application
10021002
with concurrent access like an API, it is recommended that you don't use the
10031003
Client API at all. If you do so, the client will be blocked from executing other
1004-
queries until the transaction has finished. Instead, use a connection
1005-
pool, that way all your operations will be executed in a different context
1006-
without locking the main client.
1004+
queries until the transaction has finished. Instead, use a connection pool, that
1005+
way all your operations will be executed in a different context without locking
1006+
the main client.
10071007

10081008
```ts
10091009
const client_1 = await pool.connect();
@@ -1066,8 +1066,8 @@ function executeMyTransaction() {
10661066

10671067
This limits only to database-related errors though, regular errors won't end the
10681068
connection and may allow the user to execute a different code path. This is
1069-
especially good for ahead-of-time validation errors such as the ones found in the
1070-
rollback and savepoint features.
1069+
especially good for ahead-of-time validation errors such as the ones found in
1070+
the rollback and savepoint features.
10711071

10721072
```ts
10731073
const transaction = client.createTransaction("abortable");
@@ -1098,8 +1098,8 @@ await transaction.commit();
10981098
#### Transaction options
10991099

11001100
PostgreSQL provides many options to customize the behavior of transactions, such
1101-
as isolation level, read modes, and startup snapshot. All these options can be set
1102-
by passing a second argument to the `startTransaction` method
1101+
as isolation level, read modes, and startup snapshot. All these options can be
1102+
set by passing a second argument to the `startTransaction` method
11031103

11041104
```ts
11051105
const transaction = client.createTransaction("ts_1", {
@@ -1116,8 +1116,9 @@ place _after_ the transaction had begun.
11161116

11171117
The following is a demonstration. A sensible transaction that loads a table with
11181118
some very important test results and the students that passed said test. This is
1119-
a long-running operation, and in the meanwhile, someone is tasked to clean up the
1120-
results from the tests table because it's taking up too much space in the database.
1119+
a long-running operation, and in the meanwhile, someone is tasked to clean up
1120+
the results from the tests table because it's taking up too much space in the
1121+
database.
11211122

11221123
If the transaction were to be executed as follows, the test results would be
11231124
lost before the graduated students could be extracted from the original table,
@@ -1357,7 +1358,8 @@ await transaction.rollback(savepoint); // Truncate gets undone
13571358
##### Rollback
13581359

13591360
A rollback allows the user to end the transaction without persisting the changes
1360-
made to the database, preventing that way any unwanted operation from taking place.
1361+
made to the database, preventing that way any unwanted operation from taking
1362+
place.
13611363

13621364
```ts
13631365
const transaction = client.createTransaction("rolled_back_transaction");

0 commit comments

Comments
 (0)