That would work right now, yes — that's how you can use the Cache API for anything, not just D1.
That would work right now, yes — that's how you can use the Cache API for anything, not just D1.
npm i @cloudflare/d1. There are no other projects in the npm registry using @cloudflare/d1.
wrangler, so you shouldn't need to install it for it to workctx.env object. wrangler.toml for Pages, you pass bindings via the CLI
wrangler d1 execute EmailTracker --command='SELECT * FROM SenderInfo WHERE email = "drnewt536@gmail.com";' fails, yet wrangler d1 execute EmailTracker --command="SELECT * FROM SenderInfo WHERE email = 'drnewt536@gmail.com';" passes"--" to '--'"..." means column, or general database objects - you want '...' for stringsnpm i @cloudflare/d1ctx.env[[d1_databases]]
binding = "DataB"
database_name = "thing"
database_id = "dwadwadwad3213dsfasfdaeiu2"wrangler d1 execute EmailTracker --command='SELECT * FROM SenderInfo WHERE email = "drnewt536@gmail.com";'wrangler d1 execute EmailTracker --command="SELECT * FROM SenderInfo WHERE email = 'drnewt536@gmail.com';""--"'--'"..."'...'import { D1Database, D1DatabaseAPI } from "@miniflare/d1";
import { drizzle } from "drizzle-orm/d1";
const d1 = new D1Database(new D1DatabaseAPI(sqliteDb));
const db = drizzle(d1); // now I can can write unit tests for drizzleexport default {
async fetch(req, env) {
// ...
const result = await env.D1.exec("SELECT * FROM db;");
// ...
}
}export const onRequestGet = ctx => {
const result = await ctx.env.D1.exec("SELECT * FROM db;");
// ...
};