Query String to SQL Clause Generator
Want to see pretty graphs? Log in now!
npm install clause
|4||downloads in the last week|
|8||downloads in the last month|
|Last Published By|
|Version||0.1.1 last updated 6 months ago|
|Keywords||querystring, sql, search|
A small helper module used to convert query string parameters into a SQL where clause that can be used in various SQL dialects.
Parse the input query string based on the specified SQL dialect (defaults to SQL92)
This is the base type for all sql conditions.
SQL Dialect Generators
SqlFieldCondition(fieldName, comparior, value)
The field condition type represents a simple field comparison operation,
name = "Bob" or
age = 35. This type also encapsulates simple
IS NOT NULL checks if the value is left as an empty string.
Additionally, if the value argument of the constructor is passed an array
then the operator will change from whatever was specified as a default to
IN test, e.g.
age in [35, 36].
Convert a standard field condition to a string
The parse function is used to extract the object querystring data into an array of parameter instructions that can be converted into a SQL dialect specific where clause. The function is exposed so custom dialects can reuse this portion of the code and implement their own mapping of the fields to their dialect.