pgliteQuery (engine-sql/dialect-pglite.ts)

gbrain · src/core/engine-sql/dialect-pglite.ts · typescript · MIT
database, tag:embed-classified

PGLite dialect adapter for executing SQL queries with abort support and transaction handling.

// Source: https://github.com/garrytan/gbrain | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * PGLite dialect adapter for the engine-sql executor (refactor wave 1, W1 / A4).
 *
 * Wraps one PGLite handle: the engine's attached `db` (statement cache +
 * checkpoint admission already applied by `PGLiteEngine`) or a transaction
 * handle. `PGLiteEngine#engineSql` builds a fresh adapter over `this.db` on
 * every access (EO1), so a transaction clone's executor runs on the clone's
 * handle.
 */

import type { PGlite, Transaction } from '@electric-sql/pglite';
import { renderFragment, type SqlFragment } from './fragment.ts';
import {
  isJsonbParam,
  throwIfAborted,
  type DialectCapabilities,
  type ExecResult,
  type QueryOpts,

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key