method ID1Database.batch
ID1Database.batch<T = Record<string, unknown>>(statements: readonly ID1PreparedStatement[]): Promise<readonly D1Result<T>[]>

Runs several statements as one atomic transaction. D1 exposes no imperative BEGIN/COMMIT, so this is its unit of atomicity.

Type Parameters

T = Record<string, unknown>

The row shape

Parameters

statements: readonly ID1PreparedStatement[]

The statements to run together

Return Type

Promise<readonly D1Result<T>[]>

One result per statement, in order

Usage

import { type ID1Database } from "cloudflare-plugin/src/index.ts";