interface ID1Database
Since 0.2.0

A D1 database binding.

Usable directly for applications that want raw SQL, and the binding D1Adapter wraps to serve CAPABILITIES.DATABASE through the repository and Unit-of-Work surface. M52c promoted IDatabaseAdapter into common, which is what made that backend expressible outside database-plugin.

Methods

Prepares a statement.

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.

Usage

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