Normalizes heterogeneous SQL query results from different database drivers into a uniform schema. Use this to ensure consistent data types across multiple database backends in your application.
// Source: https://github.com/garrytan/gbrain | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Row normalizer for engine-sql results (refactor wave 1, A5).
*
* PGLite and postgres.js decode some column types differently (int8 as
* number vs string, vector as text, timestamps as string on text projections).
* A statement that needs a uniform shape declares each column's kind ONCE, at
* module scope; `compileRowNormalizer` returns a function that converts only
* the declared columns and leaves every other column as the driver returned
* it. The declared kind picks the conversion, never the value's runtime type.
* `test/engine-sql-normalize.test.ts` pins each kind on both engines.
*/
import { parseEmbedding } from '../
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key