A lightweight, Rails-style model wrapper around the `sql` library for Node.js. Version 0.9.4 provides CRUD operations, query methods (findOne, findMany, count), hooks (before/after create/update/destroy), and foreign key reference expansion. It relies on ES6+ features (async/await, classes) and requires Node >=4.8.1. The package is explicitly marked as unstable and not recommended for production use. It is database-agnostic, supporting any SQL dialect that the `sql` module supports (e.g., PostgreSQL, MySQL). Release cadence is irregular; the last commit was in 2019.
npm install simple-sql-modelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Quickstart: connect to PostgreSQL, define a User model with columns, create a record and query by ID.
Use a more mature ORM like Sequelize, Knex.js, or TypeORM for production applications.
Use Node 7.8+ or transpile with Babel.
Ensure your database library's connection object has a `query` method returning a Promise. For pg-promise, use `pgp()`; for mysql, use a promise wrapper.
Consider migrating to actively maintained alternatives.
npm install sql
Use a compatible database library such as `pg-promise` or `mysql2/promise`.
Use CommonJS require: `const Model = require('simple-sql-model')`