@d1testflare/d1
TypeScript icon, indicating that this package has built-in type declarations

2.9.0 • Public • Published

@d1testflare/d1

Workers D1 module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers. See 📦 D1 for more details.

Example

import { BetaDatabase } from "@d1testflare/d1";
import { createSQLiteDB } from "@d1testflare/shared";

const db = new BetaDatabase(await createSQLiteDB(":memory:"));
await db.exec(
  `CREATE TABLE my_table (cid INTEGER PRIMARY KEY, name TEXT NOT NULL);`
);
const response = await db.prepare(`SELECT * FROM sqlite_schema`).all();
console.log(await response);
/*
{
  "success": true,
  "results": [
    {
      "type": "table",
      "name": "my_table",
      "tbl_name": "my_table",
      "rootpage": 2,
      "sql": "CREATE TABLE my_table (cid INTEGER PRIMARY KEY, name TEXT NOT NULL)"
    }
  ],
  ...
}
*/

Package Sidebar

Install

npm i @d1testflare/d1

Weekly Downloads

5

Version

2.9.0

License

MIT

Unpacked Size

14.4 kB

Total Files

5

Last publish

Collaborators

  • oconnorct1