Home / Function/ batch() — drizzle-orm Function Reference

batch() — drizzle-orm Function Reference

Architecture documentation for the batch() function in sqlite-proxy-batch.test.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  ad38d5d8_109f_ea54_c8fc_d11f94d79ae4["batch()"]
  e3dfa896_5b55_f323_34cd_1359d1f9fc08["ServerSimulator"]
  ad38d5d8_109f_ea54_c8fc_d11f94d79ae4 -->|defined in| e3dfa896_5b55_f323_34cd_1359d1f9fc08
  style ad38d5d8_109f_ea54_c8fc_d11f94d79ae4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integration-tests/tests/sqlite/sqlite-proxy-batch.test.ts lines 139–170

	async batch(queries: { sql: string; params: any[]; method: string }[]) {
		const results: { rows: any }[] = [];
		for (const query of queries) {
			const { method, sql, params } = query;

			if (method === 'run') {
				try {
					const result = this.db.prepare(sql).run(params);
					results.push(result as any);
				} catch (e: any) {
					return { error: e.message };
				}
			} else if (method === 'all' || method === 'values') {
				try {
					const rows = this.db.prepare(sql).raw().all(params);
					results.push({ rows: rows });
				} catch (e: any) {
					return { error: e.message };
				}
			} else if (method === 'get') {
				try {
					const row = this.db.prepare(sql).raw().get(params);
					results.push({ rows: row });
				} catch (e: any) {
					return { error: e.message };
				}
			} else {
				return { error: 'Unknown method value' };
			}
		}
		return results;
	}

Domain

Subdomains

Frequently Asked Questions

What does batch() do?
batch() is a function in the drizzle-orm codebase, defined in integration-tests/tests/sqlite/sqlite-proxy-batch.test.ts.
Where is batch() defined?
batch() is defined in integration-tests/tests/sqlite/sqlite-proxy-batch.test.ts at line 139.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free