From 1fd283c707d1a5d3db2d927f55f4ddf510302393 Mon Sep 17 00:00:00 2001 From: bombillazo Date: Mon, 5 Feb 2024 22:13:53 -0400 Subject: [PATCH] chore: remove import statments from JSDocs examples --- client.ts | 28 ---------------------------- pool.ts | 10 ---------- query/query.ts | 2 -- query/transaction.ts | 42 ------------------------------------------ 4 files changed, 82 deletions(-) diff --git a/client.ts b/client.ts index 6f25f654..baf217ae 100644 --- a/client.ts +++ b/client.ts @@ -105,8 +105,6 @@ export abstract class QueryClient { * In order to create a transaction, use the `createTransaction` method in your client as follows: * * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("my_transaction_name"); * @@ -119,8 +117,6 @@ export abstract class QueryClient { * the client without applying any of the changes that took place inside it * * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -137,7 +133,6 @@ export abstract class QueryClient { * the transaction * * ```ts - * import { Client } from "./client.ts"; * * const client = new Client(); * const transaction = client.createTransaction("transaction"); @@ -163,8 +158,6 @@ export abstract class QueryClient { * - Repeatable read: This isolates the transaction in a way that any external changes to the data we are reading * won't be visible inside the transaction until it has finished * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * const transaction = await client.createTransaction("my_transaction", { isolation_level: "repeatable_read" }); * ``` @@ -172,8 +165,6 @@ export abstract class QueryClient { * - Serializable: This isolation level prevents the current transaction from making persistent changes * if the data they were reading at the beginning of the transaction has been modified (recommended) * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * const transaction = await client.createTransaction("my_transaction", { isolation_level: "serializable" }); * ``` @@ -186,8 +177,6 @@ export abstract class QueryClient { * is to in conjuction with the repeatable read isolation, ensuring the data you are reading does not change * during the transaction, specially useful for data extraction * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * const transaction = await client.createTransaction("my_transaction", { read_only: true }); * ``` @@ -198,8 +187,6 @@ export abstract class QueryClient { * you can do the following: * * ```ts - * import { Client } from "./client.ts"; - * * const client_1 = new Client(); * const client_2 = new Client(); * const transaction_1 = client_1.createTransaction("transaction_1"); @@ -267,8 +254,6 @@ export abstract class QueryClient { * Execute queries and retrieve the data as array entries. It supports a generic in order to type the entries retrieved by the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * * const {rows} = await my_client.queryArray( @@ -289,8 +274,6 @@ export abstract class QueryClient { * Use the configuration object for more advance options to execute the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * const { rows } = await my_client.queryArray<[number, string]>({ * text: "SELECT ID, NAME FROM CLIENTS", @@ -305,7 +288,6 @@ export abstract class QueryClient { * Execute prepared statements with template strings * * ```ts - * import { Client } from "./client.ts"; * const my_client = new Client(); * * const id = 12; @@ -353,8 +335,6 @@ export abstract class QueryClient { * Executed queries and retrieve the data as object entries. It supports a generic in order to type the entries retrieved by the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * * const { rows } = await my_client.queryObject( @@ -374,8 +354,6 @@ export abstract class QueryClient { * Use the configuration object for more advance options to execute the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * * const {rows} = await my_client.queryObject( @@ -397,8 +375,6 @@ export abstract class QueryClient { * Execute prepared statements with template strings * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * const id = 12; * // Array<{id: number, name: string}> @@ -460,8 +436,6 @@ export abstract class QueryClient { * statements asynchronously * * ```ts - * import { Client } from "./client.ts"; - * * const client = new Client(); * await client.connect(); * await client.queryArray`UPDATE MY_TABLE SET MY_FIELD = 0`; @@ -472,8 +446,6 @@ export abstract class QueryClient { * for concurrency capabilities check out connection pools * * ```ts - * import { Client } from "./client.ts"; - * * const client_1 = new Client(); * await client_1.connect(); * // Even if operations are not awaited, they will be executed in the order they were diff --git a/pool.ts b/pool.ts index f59ebbc4..5c7d6905 100644 --- a/pool.ts +++ b/pool.ts @@ -14,8 +14,6 @@ import { DeferredAccessStack } from "./utils/deferred.ts"; * with their PostgreSQL database * * ```ts - * import { Pool } from "./pool.ts"; - * * const pool = new Pool({ * database: "database", * hostname: "hostname", @@ -35,8 +33,6 @@ import { DeferredAccessStack } from "./utils/deferred.ts"; * available connections in the pool * * ```ts - * import { Pool } from "./pool.ts"; - * * // Creates a pool with 10 max available connections * // Connection with the database won't be established until the user requires it * const pool = new Pool({}, 10, true); @@ -119,8 +115,6 @@ export class Pool { * with the database if no other connections are available * * ```ts - * import { Pool } from "./pool.ts"; - * * const pool = new Pool({}, 10); * const client = await pool.connect(); * await client.queryArray`UPDATE MY_TABLE SET X = 1`; @@ -141,8 +135,6 @@ export class Pool { * This will close all open connections and set a terminated status in the pool * * ```ts - * import { Pool } from "./pool.ts"; - * * const pool = new Pool({}, 10); * * await pool.end(); @@ -154,8 +146,6 @@ export class Pool { * will reinitialize the connections according to the original configuration of the pool * * ```ts - * import { Pool } from "./pool.ts"; - * * const pool = new Pool({}, 10); * await pool.end(); * const client = await pool.connect(); diff --git a/query/query.ts b/query/query.ts index b2d49158..502a6415 100644 --- a/query/query.ts +++ b/query/query.ts @@ -14,8 +14,6 @@ import { type Notice } from "../connection/message.ts"; * They will take the position according to the order in which they were provided * * ```ts - * import { Client } from "../client.ts"; - * * const my_client = new Client(); * * await my_client.queryArray("SELECT ID, NAME FROM PEOPLE WHERE AGE > $1 AND AGE < $2", [ diff --git a/query/transaction.ts b/query/transaction.ts index 805e6a90..84e91c32 100644 --- a/query/transaction.ts +++ b/query/transaction.ts @@ -60,8 +60,6 @@ export class Savepoint { * Releasing a savepoint will remove it's last instance in the transaction * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -73,8 +71,6 @@ export class Savepoint { * It will also allow you to set the savepoint to the position it had before the last update * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -99,8 +95,6 @@ export class Savepoint { * Updating a savepoint will update its position in the transaction execution * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -114,8 +108,6 @@ export class Savepoint { * You can also undo a savepoint update by using the `release` method * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -201,8 +193,6 @@ export class Transaction { * The begin method will officially begin the transaction, and it must be called before * any query or transaction operation is executed in order to lock the session * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction_name"); * @@ -278,8 +268,6 @@ export class Transaction { * current transaction and end the current transaction * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -292,8 +280,6 @@ export class Transaction { * start a new with the same transaction parameters in a single statement * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -353,8 +339,6 @@ export class Transaction { * the snapshot state between two transactions * * ```ts - * import { Client } from "../client.ts"; - * * const client_1 = new Client(); * const client_2 = new Client(); * const transaction_1 = client_1.createTransaction("transaction"); @@ -379,8 +363,6 @@ export class Transaction { * It supports a generic interface in order to type the entries retrieved by the query * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -391,8 +373,6 @@ export class Transaction { * * You can pass type arguments to the query in order to hint TypeScript what the return value will be * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -404,8 +384,6 @@ export class Transaction { * It also allows you to execute prepared stamements with template strings * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -422,7 +400,6 @@ export class Transaction { * Use the configuration object for more advance options to execute the query * * ```ts - * import { Client } from "./client.ts"; * * const my_client = new Client(); * const { rows } = await my_client.queryArray<[number, string]>({ @@ -438,7 +415,6 @@ export class Transaction { * Execute prepared statements with template strings * * ```ts - * import { Client } from "./client.ts"; * const my_client = new Client(); * * const id = 12; @@ -489,8 +465,6 @@ export class Transaction { * Executed queries and retrieve the data as object entries. It supports a generic in order to type the entries retrieved by the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * * const { rows } = await my_client.queryObject( @@ -510,8 +484,6 @@ export class Transaction { * Use the configuration object for more advance options to execute the query * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * * const {rows} = await my_client.queryObject( @@ -533,8 +505,6 @@ export class Transaction { * Execute prepared statements with template strings * * ```ts - * import { Client } from "./client.ts"; - * * const my_client = new Client(); * const id = 12; * // Array<{id: number, name: string}> @@ -593,8 +563,6 @@ export class Transaction { * Calling a rollback without arguments will terminate the current transaction and undo all changes. * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -609,8 +577,6 @@ export class Transaction { * Savepoints can be used to rollback specific changes part of a transaction. * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -633,8 +599,6 @@ export class Transaction { * The `chain` option allows you to undo the current transaction and restart it with the same parameters in a single statement * * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -743,8 +707,6 @@ export class Transaction { * * A savepoint can be easily created like this * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -755,8 +717,6 @@ export class Transaction { * All savepoints can have multiple positions in a transaction, and you can change or update * this positions by using the `update` and `release` methods * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); * @@ -773,8 +733,6 @@ export class Transaction { * Creating a new savepoint with an already used name will return you a reference to * the original savepoint * ```ts - * import { Client } from "../client.ts"; - * * const client = new Client(); * const transaction = client.createTransaction("transaction"); *