UNPKG

@variablesoftware/mock-d1

Version:

🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers

18 lines (17 loc) 727 B
import type { D1Row } from "../../types/MockD1Database"; /** * Extracts the table name from a SQL statement for the given type. * Throws on malformed SQL. */ export declare function extractTableName(sql: string, statementType: string): string; /** * Normalizes a table name for storage/lookup. * Quoted names are preserved as-is (case-sensitive). * Unquoted names are lowercased (case-insensitive). */ export declare function normalizeTableName(tableName: string): string; /** * Finds the actual table key in the db map for a given table name. * Returns the key if found, else undefined. */ export declare function getTableKey(db: Map<string, D1Row | Record<string, unknown>>, tableName: string): string | undefined;