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 81e68548_fd3e_f31c_c3ec_6e4899bef9c5["transaction()"] 45d8647d_c3c0_0e16_e569_86be8b7dc7ff["SQLiteD1Session"] 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 -->|defined in| 45d8647d_c3c0_0e16_e569_86be8b7dc7ff 277fa7d6_b402_be2c_9938_c260f7677755["transaction()"] 277fa7d6_b402_be2c_9938_c260f7677755 -->|calls| 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 1d5afe2c_0cde_87b6_9e0e_5be634ac18de["run()"] 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 -->|calls| 1d5afe2c_0cde_87b6_9e0e_5be634ac18de 277fa7d6_b402_be2c_9938_c260f7677755["transaction()"] 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 -->|calls| 277fa7d6_b402_be2c_9938_c260f7677755 style 81e68548_fd3e_f31c_c3ec_6e4899bef9c5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/d1/session.ts lines 111–125
override async transaction<T>(
transaction: (tx: D1Transaction<TFullSchema, TSchema>) => T | Promise<T>,
config?: SQLiteTransactionConfig,
): Promise<T> {
const tx = new D1Transaction('async', this.dialect, this, this.schema);
await this.run(sql.raw(`begin${config?.behavior ? ' ' + config.behavior : ''}`));
try {
const result = await transaction(tx);
await this.run(sql`commit`);
return result;
} catch (err) {
await this.run(sql`rollback`);
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 111.
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