like-sql is a lightweight SQL query builder for Node.js (v0.3.0). It provides a simple API for building common SQL statements (CREATE/DROP DATABASE, INSERT, SELECT, SELECT ONE, EXISTS, COUNT, UPDATE, DELETE) with parameterized queries. It is designed to be extended for specific database drivers (e.g., mysql2). The library uses a builder pattern returning arrays of [sql, values]. It has a small footprint, no runtime dependencies, and is released under MIT. Compared to larger ORMs, like-sql focuses on minimal syntax and direct SQL generation.
npm install like-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of like-sql to build INSERT, SELECT, UPDATE, and EXISTS queries.
Ensure identifiers do not contain backticks, or sanitize them before passing.
Use builder.update('ips', [{ hits: 'hits + ?' }, 1], 'addr = ?', req.ip)Do not pass user input directly as table/column names; validate or use a whitelist.
Always use the parameterized values in the array; never concatenate user input into the SQL string.
Use const SQL = require('like-sql'); const builder = new SQL();Ensure you have installed 'like-sql' and added const SQL = require('like-sql');No dependency data recorded yet.