Connectors

Cloudflare D1

Connect DB0 to Cloudflare D1


Read more in developers.cloudflare.com/d1.
This connector works within cloudflare workers with D1 enabled.

Usage

Use cloudflare-d1 connector:

import { createDatabase, sql } from "db0";
import cloudflareD1 from "db0/connectors/cloudflare-d1";

const db = createDatabase(
  cloudflareD1({
    bindingName: "DB",
  }),
);
In order for the driver to work, globalThis.__env__.DB value should be set.If you are using Nitro you don't need to do any extra steps.

Options

bindingName

Assigned binding name.