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 277fa7d6_b402_be2c_9938_c260f7677755["transaction()"] ba72f6b5_6c41_1e47_2e85_6b562ec94b86["D1Transaction"] 277fa7d6_b402_be2c_9938_c260f7677755 -->|defined in| ba72f6b5_6c41_1e47_2e85_6b562ec94b86 81e68548_fd3e_f31c_c3ec_6e4899bef9c5["transaction()"] 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 -->|calls| 277fa7d6_b402_be2c_9938_c260f7677755 1d5afe2c_0cde_87b6_9e0e_5be634ac18de["run()"] 277fa7d6_b402_be2c_9938_c260f7677755 -->|calls| 1d5afe2c_0cde_87b6_9e0e_5be634ac18de 81e68548_fd3e_f31c_c3ec_6e4899bef9c5["transaction()"] 277fa7d6_b402_be2c_9938_c260f7677755 -->|calls| 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 style 277fa7d6_b402_be2c_9938_c260f7677755 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/d1/session.ts lines 134–146
override async transaction<T>(transaction: (tx: D1Transaction<TFullSchema, TSchema>) => Promise<T>): Promise<T> {
const savepointName = `sp${this.nestedIndex}`;
const tx = new D1Transaction('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/d1/session.ts.
Where is transaction() defined?
transaction() is defined in drizzle-orm/src/d1/session.ts at line 134.
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