@variablesoftware/mock-d1
Version:
🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers
27 lines (26 loc) • 817 B
TypeScript
/**
* Validates a row against a schema (D1-compatible).
* Throws if extra columns are present or required columns are missing.
* @param columns - The schema columns array.
* @param row - The row to validate.
* @returns Result object.
*/
export declare function validateRowAgainstSchema(columns: {
original: string;
name: string;
quoted: boolean;
}[], row: Record<string, unknown>): {
result: boolean;
};
/**
* Normalizes a row to match the schema (D1-compatible).
* Fills missing columns with null.
* @param columns - The schema columns array.
* @param row - The row to normalize.
* @returns Normalized row.
*/
export declare function normalizeRowToSchema(columns: {
original: string;
name: string;
quoted: boolean;
}[], row: Record<string, unknown>): Record<string, unknown>;