meshql-postgres (@meshql/postgres)
Postgres helper for MeshQL. Builds parameterised SELECT statements from a join plan; you supply the connection.
Install
Section titled “Install”npm install meshql-postgres meshql-core pg# ornpx jsr add @meshql/postgres @meshql/corenpm i pgPublished on npm as meshql-postgres and JSR as @meshql/postgres.
Example
Section titled “Example”import { createMesh, type MeshSchema } from "meshql-core";import { buildSelectSql } from "meshql-postgres";import { Pool } from "pg";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });const schema: MeshSchema = { /* … */ };const mesh = createMesh(schema);
mesh.resolve("user", async (plan) => { const { sql, params } = buildSelectSql(plan, schema); const result = await pool.query(sql, params); return result.rows;});JSR imports: @meshql/core, @meshql/postgres.
See also @meshql/sqlite.