Extremely Popular
Latest
method Transaction.prototype.getSnapshot
import { Transaction } from "https://dotland.deno.dev/x/postgres@v0.19.3/query/transaction.ts";

This method returns the snapshot id of the on going transaction, allowing you to share the snapshot state between two transactions

import { Client } from "https://deno.land/x/postgres/mod.ts";
const client_1 = new Client();
const client_2 = new Client();
const transaction_1 = client_1.createTransaction("transaction");

const snapshot = await transaction_1.getSnapshot();
const transaction_2 = client_2.createTransaction("new_transaction", { isolation_level: "repeatable_read", snapshot });
// transaction_2 now shares the same starting state that transaction_1 had

https://www.postgresql.org/docs/14/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION

Returns

Promise<string>