@altangent/graphql-filter-mysql
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "@altangent/graphql-filter-mysql", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Graphql filtering exection to generate mysql query syntax", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -77,5 +77,11 @@ let mysqlClient = require('mysql'); | ||
} | ||
if (op._neq) { | ||
return processNeqOp(column, op._neq); | ||
} | ||
if (op._like) { | ||
return processLikeOp(column, op._like); | ||
} | ||
if (op._in) { | ||
@@ -85,2 +91,6 @@ return processInOp(column, op._in); | ||
if (op._nin) { | ||
return processNinOp(column, op._nin); | ||
} | ||
if (op._gt !== undefined) { | ||
@@ -111,2 +121,6 @@ return processGtOp(column, op._gt); | ||
function processNeqOp(column, value) { | ||
return `${column} != ${mysqlClient.escape(value)}`; | ||
} | ||
function processLikeOp(column, value) { | ||
@@ -120,2 +134,6 @@ return `${column} like ${mysqlClient.escape(value)}`; | ||
function processNinOp(column, value) { | ||
return `${column} not in (${value.map(mysqlClient.escape)})`; | ||
} | ||
function processGtOp(column, value) { | ||
@@ -122,0 +140,0 @@ return `${column} > ${mysqlClient.escape(value)}`; |
@@ -26,2 +26,7 @@ const { expect } = require('chai'); | ||
{ | ||
desc: 'should construct not equal filter', | ||
input: { currencyName: { _neq: 'bitcoin' } }, | ||
expected: " and currency_name != 'bitcoin'", // eslint-disable-line quotes | ||
}, | ||
{ | ||
desc: 'should construct like filter', | ||
@@ -37,2 +42,7 @@ input: { currencyName: { _like: '*bitcoin*' } }, | ||
{ | ||
desc: 'should construct not in filter', | ||
input: { currencySymbol: { _nin: ['BTC', 'LTC'] } }, | ||
expected: " and currency_symbol not in ('BTC','LTC')", // eslint-disable-line quotes | ||
}, | ||
{ | ||
desc: 'should and multiple filters', | ||
@@ -39,0 +49,0 @@ input: { currencyName: { _eq: 'bitcoin' }, currencySymbol: { _eq: 'BTC' } }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10785
306