transaction() — drizzle-orm Function Reference
Architecture documentation for the transaction() function in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 3c5541de_40e9_f9b6_c940_ea976fc1b1b9["transaction()"] af5b1bd6_529c_c417_9e7e_86a57f414237["TiDBServerlessTransaction"] 3c5541de_40e9_f9b6_c940_ea976fc1b1b9 -->|defined in| af5b1bd6_529c_c417_9e7e_86a57f414237 bf8d9f11_3753_f5a9_f054_5b67be4b6f0e["transaction()"] bf8d9f11_3753_f5a9_f054_5b67be4b6f0e -->|calls| 3c5541de_40e9_f9b6_c940_ea976fc1b1b9 0d0d9914_7bbd_c75e_f74a_0d3e57b68553["execute()"] 3c5541de_40e9_f9b6_c940_ea976fc1b1b9 -->|calls| 0d0d9914_7bbd_c75e_f74a_0d3e57b68553 bf8d9f11_3753_f5a9_f054_5b67be4b6f0e["transaction()"] 3c5541de_40e9_f9b6_c940_ea976fc1b1b9 -->|calls| bf8d9f11_3753_f5a9_f054_5b67be4b6f0e style 3c5541de_40e9_f9b6_c940_ea976fc1b1b9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/tidb-serverless/session.ts lines 209–228
override async transaction<T>(
transaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>,
): Promise<T> {
const savepointName = `sp${this.nestedIndex + 1}`;
const tx = new TiDBServerlessTransaction<TFullSchema, TSchema>(
this.dialect,
this.session,
this.schema,
this.nestedIndex + 1,
);
await tx.execute(sql.raw(`savepoint ${savepointName}`));
try {
const result = await transaction(tx);
await tx.execute(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
await tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does transaction() do?
transaction() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/tidb-serverless/session.ts.
Where is transaction() defined?
transaction() is defined in drizzle-orm/src/tidb-serverless/session.ts at line 209.
What does transaction() call?
transaction() calls 2 function(s): execute, transaction.
What calls transaction()?
transaction() is called by 1 function(s): transaction.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free