Custom query format for named parameters in node-mysql.
npm install mysql-named-params-escape
npm install mysql-named-params-escape
`Usage
`javascript
var npEscape = require('mysql-named-params-escape');
`$3
`javascript
var query = "SELECT ::something FROM ::table WHERE ::table.::whatever = :value";
var params = {
something: 'title',
table: 'foo',
whatever: 'id',
value: 123
};// SELECT
title FROM foo WHERE foo.id = 123;
`$3
`javascript
query = npEscape(query, params);connection.query(query);
`$3
`javascript
connection.config.queryFormat = npEscape;connection.query(query, params);
`$3
#### query
Type:
StringThe string of MYSQL code to be escaped.
:: followed by a word denotes an identifier to be escaped.
: followed by a word denotes a value to be escaped.#### params
Type:
Object`An object in which the keys correspond to placeholders in the query. The placeholders will be replaced with the values from the object.