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 6eb2105d_a07f_dc00_c56f_931a711ee608["transaction()"] fd9e1e8d_8470_d91a_8e8d_5f87d3c0bb27["SQLiteProxyTransaction"] 6eb2105d_a07f_dc00_c56f_931a711ee608 -->|defined in| fd9e1e8d_8470_d91a_8e8d_5f87d3c0bb27 edc293b9_1f8b_73c9_efa3_55f353a3b344["transaction()"] edc293b9_1f8b_73c9_efa3_55f353a3b344 -->|calls| 6eb2105d_a07f_dc00_c56f_931a711ee608 24c3dc35_447a_e607_7a19_f28b54bde3d6["run()"] 6eb2105d_a07f_dc00_c56f_931a711ee608 -->|calls| 24c3dc35_447a_e607_7a19_f28b54bde3d6 edc293b9_1f8b_73c9_efa3_55f353a3b344["transaction()"] 6eb2105d_a07f_dc00_c56f_931a711ee608 -->|calls| edc293b9_1f8b_73c9_efa3_55f353a3b344 style 6eb2105d_a07f_dc00_c56f_931a711ee608 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/sqlite-proxy/session.ts lines 126–140
override async transaction<T>(
transaction: (tx: SQLiteProxyTransaction<TFullSchema, TSchema>) => Promise<T>,
): Promise<T> {
const savepointName = `sp${this.nestedIndex}`;
const tx = new SQLiteProxyTransaction('async', this.dialect, this.session, this.schema, this.nestedIndex + 1);
await this.session.run(sql.raw(`savepoint ${savepointName}`));
try {
const result = await transaction(tx);
await this.session.run(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
await this.session.run(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/sqlite-proxy/session.ts.
Where is transaction() defined?
transaction() is defined in drizzle-orm/src/sqlite-proxy/session.ts at line 126.
What does transaction() call?
transaction() calls 2 function(s): run, 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