@variablesoftware/mock-d1
Version:
🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers
26 lines (25 loc) • 940 B
TypeScript
import { D1TableData } from "../../types/MockD1Database";
/**
* Handles DELETE FROM <table> [WHERE ...] statements for the mock D1 engine.
* Deletes rows from the specified table, optionally filtered by a WHERE clause.
*
* @param sql - The SQL DELETE statement string.
* @param db - The in-memory database map.
* @param bindArgs - The named bind arguments for the statement.
* @returns An object representing the result of the DELETE operation.
* @throws If the SQL statement is malformed or required bind arguments are missing.
*/
export declare function handleDelete(sql: string, db: Map<string, D1TableData>, bindArgs: Record<string, unknown>): {
success: boolean;
results: never[];
changes: number;
meta: {
duration: number;
size_after: number;
rows_read: number;
rows_written: number;
last_row_id: number;
changed_db: boolean;
changes: number;
};
};