@variablesoftware/mock-d1
Version:
🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers
24 lines (23 loc) • 789 B
TypeScript
import { D1TableData } from "../../types/MockD1Database";
/**
* Handles CREATE TABLE [IF NOT EXISTS] <table> statements for the mock D1 engine.
* Adds the table to the in-memory database if it does not already exist.
*
* @param sql - The SQL statement string.
* @param db - The in-memory database map.
* @returns An object representing the result of the CREATE TABLE operation.
* @throws If the SQL statement is malformed.
*/
export declare function handleCreateTable(sql: string, db: Map<string, D1TableData>): void | {
success: boolean;
results: never[];
meta: {
duration: number;
size_after: number;
rows_read: number;
rows_written: number;
last_row_id: number;
changed_db: boolean;
changes: number;
};
};