Skip to content

Search the guides, deployment pages, and API reference.

D1Binding

import type { D1Binding } from "@pitlane/data-table-d1";

The slice of Cloudflare's D1 API this driver uses.

Declared structurally rather than imported from @cloudflare/workers-types, so the package adds no dependency and no ambient global types to a consumer that does not already have them. A real D1Database binding satisfies it; so does a test double.

Methods

batch()

batch(statements): Promise<D1Result[]>;

Runs the statements in order inside one transaction, resolving to one result each.

Parameters

statements

D1PreparedStatement[]

Returns

Promise<D1Result[]>


exec()

exec(query): Promise<unknown>;

Runs raw SQL, which may hold several statements, without binding or returning rows.

Parameters

query

string

Returns

Promise<unknown>


prepare()

prepare(query): D1PreparedStatement;

Compiles one SQL statement with ? placeholders, without running it.

Parameters

query

string

Returns

D1PreparedStatement