Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christianmalek/node-mysql-es6-query
A helper function to build queries with ES6 template strings.
https://github.com/christianmalek/node-mysql-es6-query
es6 mysql node-mysql nodejs
Last synced: about 2 months ago
JSON representation
A helper function to build queries with ES6 template strings.
- Host: GitHub
- URL: https://github.com/christianmalek/node-mysql-es6-query
- Owner: christianmalek
- Created: 2016-01-09T23:37:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-09T23:44:44.000Z (almost 9 years ago)
- Last Synced: 2023-08-12T06:36:59.003Z (over 1 year ago)
- Topics: es6, mysql, node-mysql, nodejs
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-mysql-es6-query
A helper function to build queries with ES6 template strings in [node-mysql](https://github.com/felixge/node-mysql).## How it works
```js
"use strict";//require the node mysql module
let mysql = require("mysql");//require the es6 query file and pass the mysql.escape fn
let SQL = require( "sql"))(mysql.escape);//now you can write SQL in front of the ES6 Template Strings and they get escaped
connection.query(SQL`SELECT username, password
FROM account
WHERE username = ${username}
LIMIT 1`, (err, rows) => {//more code
});