meshql-sqlite
v0.5.4
Published
MeshQL SQLite helper - build parameterized SELECT statements from a join plan, runs on Node's built-in node:sqlite
Readme
@meshql/sqlite
SQLite helper for MeshQL. Builds parameterised SELECT statements from a join plan; runs on Node 22.5+'s built-in node:sqlite (no native deps).
Install
npm install meshql-sqlite meshql-core
# or
npx jsr add @meshql/sqlite @meshql/corePublished on npm as meshql-sqlite and JSR as @meshql/sqlite.
Example
import { DatabaseSync } from "node:sqlite";
import { createMesh, type MeshSchema } from "meshql-core";
import { buildSelectSql } from "meshql-sqlite";
const db = new DatabaseSync(":memory:");
const schema: MeshSchema = { /* … */ };
const mesh = createMesh(schema);
mesh.resolve("user", async (plan) => {
const { sql, params } = buildSelectSql(plan, schema);
return db.prepare(sql).all(...params);
});JSR imports: @meshql/core, @meshql/sqlite.
See also @meshql/postgres.
