Gatepost is a reverse ORM for PostgreSQL that binds SQL statements to Model factories and instances, casting results as Model instances without modeling the database schema. It relies on VeryModel for model validation and allows flexible SQL generation via knex, template strings, or raw queries. Current stable version is 7.2.0. Unlike traditional ORMs, Gatepost focuses on query results rather than table structures. It uses Promises and supports caching. Release cadence is irregular. Key differentiators: schema-agnostic, compatible with knex, and uses VeryModel for validation.
npm install gatepostNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing Gatepost, connecting to PostgreSQL, defining a Model, and executing a SQL query with a template string.
const gp = require('gatepost')(connectionString); const Model = gp.Model;Ensure sql returns a plain string, {text, values} object, or knex query builder.Use .then()/.catch() or async/await.
Use `import Gatepost from 'gatepost'` or `const Gatepost = require('gatepost').default`Run `npm install verymodel`
Catch the EmptyResult error or ensure the query returns exactly one row.