Skip to content

Commit dd7df18

Browse files
authored
Bump version test (#503)
* chore: update version * chore: update docs formatting
1 parent 8da93ab commit dd7df18

File tree

3 files changed

+34
-29
lines changed

3 files changed

+34
-29
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ await client.connect();
5151
}
5252

5353
{
54-
const result =
55-
await client.queryArray`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;
54+
const result = await client
55+
.queryArray`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;
5656
console.log(result.rows); // [[1, 'Carlos']]
5757
}
5858

@@ -62,8 +62,8 @@ await client.connect();
6262
}
6363

6464
{
65-
const result =
66-
await client.queryObject`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;
65+
const result = await client
66+
.queryObject`SELECT ID, NAME FROM PEOPLE WHERE ID = ${1}`;
6767
console.log(result.rows); // [{id: 1, name: 'Carlos'}]
6868
}
6969

deno.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@db/postgres",
3-
"version": "0.19.4",
3+
"version": "0.19.5",
44
"license": "MIT",
55
"exports": "./mod.ts",
66
"imports": {

docs/README.md

+29-24
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@ const path = "/var/run/postgresql";
300300

301301
const client = new Client(
302302
// postgres://user:password@%2Fvar%2Frun%2Fpostgresql:port/database_name
303-
`postgres://user:password@${encodeURIComponent(path)}:port/database_name`
303+
`postgres://user:password@${encodeURIComponent(path)}:port/database_name`,
304304
);
305305
```
306306

307307
Additionally, you can specify the host using the `host` URL parameter
308308

309309
```ts
310310
const client = new Client(
311-
`postgres://user:password@:port/database_name?host=/var/run/postgresql`
311+
`postgres://user:password@:port/database_name?host=/var/run/postgresql`,
312312
);
313313
```
314314

@@ -355,7 +355,7 @@ const client = new Client({
355355
tls: {
356356
caCertificates: [
357357
await Deno.readTextFile(
358-
new URL("./my_ca_certificate.crt", import.meta.url)
358+
new URL("./my_ca_certificate.crt", import.meta.url),
359359
),
360360
],
361361
enabled: false,
@@ -582,7 +582,7 @@ variables required, and then provide said variables in an array of arguments
582582
{
583583
const result = await client.queryArray(
584584
"SELECT ID, NAME FROM PEOPLE WHERE AGE > $1 AND AGE < $2",
585-
[10, 20]
585+
[10, 20],
586586
);
587587
console.log(result.rows);
588588
}
@@ -605,7 +605,7 @@ replaced at runtime with an argument object
605605
{
606606
const result = await client.queryArray(
607607
"SELECT ID, NAME FROM PEOPLE WHERE AGE > $MIN AND AGE < $MAX",
608-
{ min: 10, max: 20 }
608+
{ min: 10, max: 20 },
609609
);
610610
console.log(result.rows);
611611
}
@@ -632,7 +632,7 @@ places in your query
632632
FROM PEOPLE
633633
WHERE NAME ILIKE $SEARCH
634634
OR LASTNAME ILIKE $SEARCH`,
635-
{ search: "JACKSON" }
635+
{ search: "JACKSON" },
636636
);
637637
console.log(result.rows);
638638
}
@@ -654,16 +654,16 @@ prepared statements with a nice and clear syntax for your queries
654654

655655
```ts
656656
{
657-
const result =
658-
await client.queryArray`SELECT ID, NAME FROM PEOPLE WHERE AGE > ${10} AND AGE < ${20}`;
657+
const result = await client
658+
.queryArray`SELECT ID, NAME FROM PEOPLE WHERE AGE > ${10} AND AGE < ${20}`;
659659
console.log(result.rows);
660660
}
661661

662662
{
663663
const min = 10;
664664
const max = 20;
665-
const result =
666-
await client.queryObject`SELECT ID, NAME FROM PEOPLE WHERE AGE > ${min} AND AGE < ${max}`;
665+
const result = await client
666+
.queryObject`SELECT ID, NAME FROM PEOPLE WHERE AGE > ${min} AND AGE < ${max}`;
667667
console.log(result.rows);
668668
}
669669
```
@@ -712,7 +712,8 @@ await client.queryArray`UPDATE TABLE X SET Y = 0 WHERE Z = ${my_id}`;
712712
// Invalid attempt to replace a specifier
713713
const my_table = "IMPORTANT_TABLE";
714714
const my_other_id = 41;
715-
await client.queryArray`DELETE FROM ${my_table} WHERE MY_COLUMN = ${my_other_id};`;
715+
await client
716+
.queryArray`DELETE FROM ${my_table} WHERE MY_COLUMN = ${my_other_id};`;
716717
```
717718

718719
### Result decoding
@@ -752,7 +753,7 @@ available:
752753
});
753754

754755
const result = await client.queryArray(
755-
"SELECT ID, NAME, AGE, BIRTHDATE FROM PEOPLE WHERE ID = 1"
756+
"SELECT ID, NAME, AGE, BIRTHDATE FROM PEOPLE WHERE ID = 1",
756757
);
757758
console.log(result.rows); // [[1, "Laura", 25, Date('1996-01-01') ]]
758759

@@ -768,7 +769,7 @@ available:
768769
});
769770

770771
const result = await client.queryArray(
771-
"SELECT ID, NAME, AGE, BIRTHDATE FROM PEOPLE WHERE ID = 1"
772+
"SELECT ID, NAME, AGE, BIRTHDATE FROM PEOPLE WHERE ID = 1",
772773
);
773774
console.log(result.rows); // [["1", "Laura", "25", "1996-01-01"]]
774775
}
@@ -804,7 +805,7 @@ the strategy and internal decoders.
804805
});
805806

806807
const result = await client.queryObject(
807-
"SELECT ID, NAME, IS_ACTIVE FROM PEOPLE"
808+
"SELECT ID, NAME, IS_ACTIVE FROM PEOPLE",
808809
);
809810
console.log(result.rows[0]);
810811
// {id: '1', name: 'Javier', is_active: { value: false, type: "boolean"}}
@@ -833,7 +834,7 @@ for the array type itself.
833834
});
834835

835836
const result = await client.queryObject(
836-
"SELECT ARRAY[ 2, 2, 3, 1 ] AS scores, 8 final_score;"
837+
"SELECT ARRAY[ 2, 2, 3, 1 ] AS scores, 8 final_score;",
837838
);
838839
console.log(result.rows[0]);
839840
// { scores: [ 200, 200, 300, 100 ], final_score: 800 }
@@ -849,7 +850,7 @@ IntelliSense
849850
```ts
850851
{
851852
const array_result = await client.queryArray<[number, string]>(
852-
"SELECT ID, NAME FROM PEOPLE WHERE ID = 17"
853+
"SELECT ID, NAME FROM PEOPLE WHERE ID = 17",
853854
);
854855
// [number, string]
855856
const person = array_result.rows[0];
@@ -865,7 +866,7 @@ IntelliSense
865866

866867
{
867868
const object_result = await client.queryObject<{ id: number; name: string }>(
868-
"SELECT ID, NAME FROM PEOPLE WHERE ID = 17"
869+
"SELECT ID, NAME FROM PEOPLE WHERE ID = 17",
869870
);
870871
// {id: number, name: string}
871872
const person = object_result.rows[0];
@@ -930,7 +931,7 @@ one the user might expect
930931

931932
```ts
932933
const result = await client.queryObject(
933-
"SELECT ID, SUBSTR(NAME, 0, 2) FROM PEOPLE"
934+
"SELECT ID, SUBSTR(NAME, 0, 2) FROM PEOPLE",
934935
);
935936

936937
const users = result.rows; // [{id: 1, substr: 'Ca'}, {id: 2, substr: 'Jo'}, ...]
@@ -958,7 +959,7 @@ interface User {
958959
}
959960

960961
const result = await client.queryObject<User>(
961-
"SELECT ID, SUBSTR(NAME, 0, 2) FROM PEOPLE"
962+
"SELECT ID, SUBSTR(NAME, 0, 2) FROM PEOPLE",
962963
);
963964

964965
const users = result.rows; // TypeScript says this will be User[]
@@ -1183,7 +1184,8 @@ const transaction = client_1.createTransaction("transaction_1");
11831184

11841185
await transaction.begin();
11851186

1186-
await transaction.queryArray`CREATE TABLE TEST_RESULTS (USER_ID INTEGER, GRADE NUMERIC(10,2))`;
1187+
await transaction
1188+
.queryArray`CREATE TABLE TEST_RESULTS (USER_ID INTEGER, GRADE NUMERIC(10,2))`;
11871189
await transaction.queryArray`CREATE TABLE GRADUATED_STUDENTS (USER_ID INTEGER)`;
11881190

11891191
// This operation takes several minutes
@@ -1239,7 +1241,8 @@ following levels of transaction isolation:
12391241
const password_1 = rows[0].password;
12401242

12411243
// Concurrent operation executed by a different user in a different part of the code
1242-
await client_2.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'something_else' WHERE ID = ${the_same_id}`;
1244+
await client_2
1245+
.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'something_else' WHERE ID = ${the_same_id}`;
12431246

12441247
const { rows: query_2 } = await transaction.queryObject<{
12451248
password: string;
@@ -1277,12 +1280,14 @@ following levels of transaction isolation:
12771280
}>`SELECT PASSWORD FROM IMPORTANT_TABLE WHERE ID = ${my_id}`;
12781281

12791282
// Concurrent operation executed by a different user in a different part of the code
1280-
await client_2.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'something_else' WHERE ID = ${the_same_id}`;
1283+
await client_2
1284+
.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'something_else' WHERE ID = ${the_same_id}`;
12811285

12821286
// This statement will throw
12831287
// Target was modified outside of the transaction
12841288
// User may not be aware of the changes
1285-
await transaction.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'shiny_new_password' WHERE ID = ${the_same_id}`;
1289+
await transaction
1290+
.queryArray`UPDATE IMPORTANT_TABLE SET PASSWORD = 'shiny_new_password' WHERE ID = ${the_same_id}`;
12861291

12871292
// Transaction is aborted, no need to end it
12881293

@@ -1419,7 +1424,7 @@ explained above in the `Savepoint` documentation.
14191424

14201425
```ts
14211426
const transaction = client.createTransaction(
1422-
"partially_rolled_back_transaction"
1427+
"partially_rolled_back_transaction",
14231428
);
14241429
await transaction.savepoint("undo");
14251430
await transaction.queryArray`TRUNCATE TABLE DONT_DELETE_ME`; // Oops, wrong table

0 commit comments

Comments
 (0)