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

sqlqs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlqs - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
package-lock.json

Sorry, the diff of this file is too big to display

+3
-3
{
"name": "sqlqs",
"version": "1.1.0",
"version": "1.1.1",
"description": "Parse query string objects into SQL where clauses",

@@ -26,4 +26,4 @@ "main": "index.js",

"prettier": "^1.12.1",
"travis-deploy-once": "^5.0.0",
"semantic-release": "^15.2.0"
"semantic-release": "^15.2.0",
"travis-deploy-once": "^5.0.0"
},

@@ -30,0 +30,0 @@ "repository": {

+15
-21

@@ -0,4 +1,8 @@

## sqlqs - sql query strings
[![Build Status](https://travis-ci.org/kissmygritts/sqlqs.svg?branch=master)](https://travis-ci.org/kissmygritts/sqlqs)
A very simple and rudimentary query string to SQL predicate parser.
Heavily influenced by the query string methods from the PostgREST API server, this module will create SQL WHERE clause predicates from the query string. With PostgREST the query string handles almost all of the database filtering and logic. For instance, to filter the database the query string may look like the following, `?x=eq.10`. Where x is the column to filter, `eq` is the operator to use, and `10` is the criteria to filter by. I call these a predicate object. I found this query string structure very flexible and decided to try and recreate it with Node.
Heavily influenced by the query string methods from the PostgREST API server, this module will create SQL WHERE clause predicates from the query string. With PostgREST the query string handles almost all of the database filtering. For instance, to filter the database the query string may look like the following, `?x=eq.10`. Where x is the column to filter, `eq` is the operator to use, and `10` is the criteria to filter. I call these a predicate object. I found this query string structure very flexible and decided to try and recreate it with Node.

@@ -8,3 +12,3 @@ ## Use

``` javascript
const sqlqs = require('sqlqs')
const { parse, sqlize } = require('sqlqs')

@@ -17,28 +21,18 @@ let qs = {

let predicates = sqlqs.parse(qs)
parse(qs)
// returns
[
{
column: 'class',
operator: 'IN',
criteria: ['Mammal', 'Bird']
},
{
column: 'genus',
operator: '=',
criteria: 'Neotoma'
},
{
column: 'id',
operator: '>',
criteria: '1000'
}
{"column":"class","operator":"IN","criteria":["Mammal","Bird"]},{"column":"genus","operator":"=","criteria":"Neotoma"},
{"column":"id","operator":">","criteria":"1000"}
]
// pass this object to the predicate function
let where = sqlqs.predicate(predicates)
sqlize(pars(qs))
// returns
'class IN (\'Mammal\',\'Bird\') AND genus = \'Neotoma\' AND id > 1000'
"class IN ('Mammal','Bird') AND genus = 'Neotoma' AND id > 1000"
```
[Try it on RunKit](https://runkit.com/kissmygritts/sqlqs)
## Caveats

@@ -45,0 +39,0 @@

Sorry, the diff of this file is too big to display