A lightweight wrapper around postgres.js (the porsager/postgres library) for building partial and dynamic SQL queries. Version 0.2.0 is the latest and only release. Unlike query builders like Knex or raw template strings, postgres-partial allows composing SQL fragments (e.g., WHERE clauses, SET clauses) that are merged into a final statement while preserving parameter safety. Designed for projects that use postgres.js and need a minimal, typed way to conditionally build queries without a full ORM. Types included.
npm install postgres-partialNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows building a SELECT query with dynamic WHERE conditions using `and`, `eq`, and the `PartialQuery` object.
Use e.g. eq('name', userInput) instead of sql`name = ${userInput}`.None.
None.
Ensure you have imported `sql` from 'postgres-partial' (not from 'postgres') and that the template literal uses the imported `sql` function.
Add `import { eq } from 'postgres-partial'`.