Skip to content

Add condiitions to verify rows are not soft deleted.

License

Notifications You must be signed in to change notification settings

ReMatter/paranoid-sql

Repository files navigation

paranoid-sql

Add conditions to verify rows are not soft deleted.

Installation

$ npm i @rematter/paranoid-sql
OR
$ yarn add @rematter/paranoid-sql

Usage

import { getParanoidSql } from '@rematter/paranoid-sql';

const paranoidSql = getParanoidSql('SELECT * FROM t WHERE status = ?')

paranoidSql // => 'SELECT * FROM `t` WHERE `status` = ? AND `t`.`deletedAt` IS NULL'

Built With

  • node-sql-parser - Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList, columnList and convert it back to SQL.

Authors/maintainers

License

This project is licensed under the MIT License - see the LICENSE.md file for details