Lightweight SQL helper library (v1.5.4) providing escape and format utilities for MySQL and PostgreSQL. Uses sqlstring under the hood for MySQL (same as mysql2) and pg-promise for PostgreSQL. Offers consistent API across both dialects, supporting parameterized queries, array/object insertion, and raw value interpolation. Released under MIT license, maintained on GitHub.
npm install sqlutilsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to escape a string for PostgreSQL and format an INSERT query with an object for MySQL.
Use correct import path: import from 'sqlutils/pg/format' not 'sqlutils'.
Use `format('... ?', obj)` for object insertion; for single values, use escape or pg-promise's native formatting.Only use '!key' with trusted constants; for user input, use regular keys.
Check MySQL documentation; buildWhereFromQuery may not be available for MySQL.
Use 'sqlutils/pg' or 'sqlutils/mysql' instead.
Use `import format from 'sqlutils/pg/format'` or default import from subpath.
Use `require('sqlutils/pg/escape')` or destructure from subpath.