Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Transaction

import { Transaction } from "https://raw.githubusercontent.com/jeremyBanks/database/0.1.0-dev/sql/sql.ts";
class Transaction<Meta extends driver.MetaBase> {
constructor(
driverConnection: driver.Connection<Meta>,
driverTransaction: driver.Transaction<Meta>,
context: Context,
);
private contextCloser: () => void;
private operationLock: Mutex;
closedDeferred;
readonly context: Context;
 
async closed(): Promise<void>;
async commit(): Promise<void>;
async prepareStatement(sqlString: string): Promise<PreparedStatement<Meta>>;
async rollback(): Promise<void>;
async startTransaction(): Promise<Transaction<Meta>>;
}

§Type Parameters

§Constructors

§
new Transaction(driverConnection: driver.Connection<Meta>, driverTransaction: driver.Transaction<Meta>, context: Context)
[src]

§Properties

§
contextCloser: () => void
[src]
§
operationLock: Mutex
[src]

Lock that must be held by the currently-open child transaction or operation.

§
closedDeferred
[src]

§Methods

§
closed(): Promise<void>
[src]

Blocks until the transaction is closed.

Will not typically throw.

§
commit(): Promise<void>
[src]

Closes the transaction and any open nested transactions with changes committed.

May throw DatabaseConnectivityError or DatabaseEngineError.

§
prepareStatement(sqlString: string): Promise<PreparedStatement<Meta>>
[src]

Prepares a SQL query for execution in this transaction.

May throw DatabaseConnectivityError or DatabaseEngineError.

§
rollback(): Promise<void>
[src]

Closes the transaction and any open nested transactions with changes rolled back.

May throw DatabaseConnectivityError or DatabaseEngineError.

§
startTransaction(): Promise<Transaction<Meta>>
[src]

Starts a nested transaction within this transaction. If a nested transaction is already in progress, this will block until it is closed. While a nested transaction is in progress, queries should be executed through the inner-most active transaction, not the parent transaction, or else they will block until the child transaction is closed.

May throw DatabaseConnectivityError or DatabaseEngineError.