New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-sqlizer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sqlizer

A sql helper to generate complex sql query.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Node-Sqlizer

npm version

Node-Sqlizer is a helper to generate complex sql query statement.

Originally inspired by functions in Toshihiko.

Install

$ npm install --save node-sqlizer

API

API Doc

Example

let query = {
  table: 'test',
  where: {
    key1: 'value1',
    key2: {
      $or: {
        $neq: 'value2',
        $in: [2, 3, 4],
      },
    },
    key3: {
      $like: '%test%',
    },
  },
  limit: [10, 20],
  orderBy: 'key1 DESC',
};
let sqlizedQuery = Sqlizer.getSql(query);
// sqlizedQuery will be
// 'SELECT * FROM `test` WHERE (`key1` = "value1" AND ((`key2` != "value2" OR `key2` IN (2, 3, 4))) AND (`key3` LIKE "%test%")) ORDER BY key1 DESC LIMIT 10, 20'

License

MIT

Keywords

node-mysql

FAQs

Package last updated on 29 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts