async-mysql
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,6 +5,20 @@ 'use strict'; | ||
sourcemaps = require('gulp-sourcemaps'), | ||
babel = require('gulp-babel'); | ||
babel = require('gulp-babel'), | ||
eslint = require('gulp-eslint'), | ||
mocha = require('gulp-mocha'); | ||
gulp.task('default', function () { | ||
require('babel/register')({ | ||
experimental: true | ||
}); | ||
gulp.task('lint', function () { | ||
return gulp | ||
.src(['./src/**/*.js', './src/tests/**/*.js']) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failOnError()); | ||
}); | ||
gulp.task('bundle', ['lint'], function () { | ||
return gulp | ||
.src('src/main.js') | ||
@@ -20,4 +34,14 @@ .pipe(sourcemaps.init()) | ||
gulp.task('test', ['bundle'], function () { | ||
return gulp | ||
.src('./tests/*.js', { | ||
read: false | ||
}) | ||
.pipe(mocha()); | ||
}); | ||
gulp.task('default', ['test']); | ||
gulp.task('watch', function () { | ||
gulp.watch('src/**/*', ['default']); | ||
gulp.watch(['src/**/*', 'tests/**/*'], ['default']); | ||
}); |
{ | ||
"name": "async-mysql", | ||
"description": "async-mysql is a wrapper for mysql that uses ES7 async functions.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "src/main.js", | ||
@@ -22,10 +22,17 @@ "author": { | ||
"devDependencies": { | ||
"babel": "^4.7.16", | ||
"babel-eslint": "^2.0.2", | ||
"babel-runtime": "^4.7.16", | ||
"chai": "^2.1.2", | ||
"gulp": "^3.8.11", | ||
"gulp-babel": "^4.0.0", | ||
"gulp-sourcemaps": "^1.5.1" | ||
"gulp-eslint": "^0.7.0", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-sourcemaps": "^1.5.1", | ||
"mocha": "^2.2.1" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^2.9.14", | ||
"mysql": "^2.5.5" | ||
} | ||
} |
# async-mysql | ||
async-mysql is a wrapper for [mysql](https://www.npmjs.com/package/mysql) that uses ES7 async functions. | ||
[![NPM version](http://img.shields.io/npm/v/async-mysql.svg?style=flat)](https://www.npmjs.org/package/async-mysql) | ||
[![Travis build status](http://img.shields.io/travis/gajus/async-mysql/master.svg?style=flat)](https://travis-ci.org/gajus/async-mysql) | ||
[![Dependency Status](https://david-dm.org/gajus/async-mysql.svg?style=flat)](https://david-dm.org/gajus/async-mysql) | ||
async-mysql is a wrapper for [mysql](https://www.npmjs.com/package/mysql) that uses [ES7 async functions](https://github.com/lukehoban/ecmascript-asyncawait). | ||
## Usage | ||
```js | ||
let mysql = require('async-mysql'), | ||
connection, | ||
rows; | ||
let main; | ||
connection = await mysql.connect({ | ||
host: 'localhost' | ||
}); | ||
// async/await can be used only within an async function. | ||
main = async () => { | ||
let mysql = require('async-mysql'), | ||
connection, | ||
rows; | ||
rows = await connection.query('SELECT 1'); | ||
connection = await mysql.connect({ | ||
host: 'localhost' | ||
}); | ||
console.log('rows', rows); | ||
rows = await connection.query('SELECT 1'); | ||
// [{'1': 1}] | ||
// [1] | ||
try { | ||
await connection.query('INVALID_QUERY'); | ||
} catch (e) { | ||
e; | ||
// [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INVALID_QUERY' at line 1] | ||
} | ||
}; | ||
main(); | ||
``` |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances 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
14387
10
187
37
2
10
9
+ Addedbluebird@^2.9.14
+ Addedbluebird@2.11.0(transitive)