import { Transaction } from "https://dotland.deno.dev/x/postgres@v0.19.0/query/transaction.ts";
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
import { Client } from "https://deno.land/x/postgres/mod.ts";
const client = new Client();
const transaction = client.createTransaction("transaction_name");
await transaction.begin(); // Session is locked, transaction operations are now safe
// Important operations
await transaction.commit(); // Session is unlocked, external operations can now take place