batch() — drizzle-orm Function Reference
Architecture documentation for the batch() function in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 8bf2cef9_a7b3_f918_cc5e_674e07849e68["batch()"] 45d8647d_c3c0_0e16_e569_86be8b7dc7ff["SQLiteD1Session"] 8bf2cef9_a7b3_f918_cc5e_674e07849e68 -->|defined in| 45d8647d_c3c0_0e16_e569_86be8b7dc7ff 406e3a87_50a6_8ba8_a8f5_7d8e0f572e95["batch()"] 406e3a87_50a6_8ba8_a8f5_7d8e0f572e95 -->|calls| 8bf2cef9_a7b3_f918_cc5e_674e07849e68 style 8bf2cef9_a7b3_f918_cc5e_674e07849e68 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/d1/session.ts lines 77–97
async batch<T extends BatchItem<'sqlite'>[] | readonly BatchItem<'sqlite'>[]>(queries: T) {
const preparedQueries: PreparedQuery[] = [];
const builtQueries: D1PreparedStatement[] = [];
for (const query of queries) {
const preparedQuery = query._prepare();
const builtQuery = preparedQuery.getQuery();
preparedQueries.push(preparedQuery);
if (builtQuery.params.length > 0) {
builtQueries.push((preparedQuery as D1PreparedQuery).stmt.bind(...builtQuery.params));
} else {
const builtQuery = preparedQuery.getQuery();
builtQueries.push(
this.client.prepare(builtQuery.sql).bind(...builtQuery.params),
);
}
}
const batchResults = await this.client.batch<any>(builtQueries);
return batchResults.map((result, i) => preparedQueries[i]!.mapResult(result, true));
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does batch() do?
batch() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/d1/session.ts.
Where is batch() defined?
batch() is defined in drizzle-orm/src/d1/session.ts at line 77.
What calls batch()?
batch() is called by 1 function(s): batch.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free