Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mysql-wrap-production

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql-wrap-production - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

deploy/docker-compose.yml

4

config.json
{
"mysql": {
"host": "127.0.0.1",
"user": "admin",
"password": "admin",
"user": "root",
"password": "password",
"database": "mysql-test"
}
}
module.exports = function (grunt) {
grunt.initConfig({
mochaTest: {
all: {
// options: { reporter: 'dot' },
src: ['test/**/*.js']
}
all: { src: ['test/**/*.js'] }
}

@@ -9,0 +6,0 @@ });

{
"name": "mysql-wrap-production",
"version": "0.7.2",
"version": "0.7.3",
"description": "Mysql interface and helper functions, wrapping node-mysql",

@@ -34,4 +34,5 @@ "main": "src/mysql-wrap.js",

"lodash": "^3.10.1",
"q": "^1.4.1"
"q": "^1.4.1",
"squel": "^5.4.2"
}
}
'use strict';
let _ = require('lodash');
let Q = require('q');
const _ = require('lodash');
const Q = require('q');
const squel = require('squel');

@@ -11,2 +12,5 @@ Q.longStackSupport = true;

// let self = function () {
// console.log('called');
// };
let self = {};

@@ -128,2 +132,29 @@

self.build = () => {
const wrap = method => {
return () => {
let s = squel[method]({
autoQuoteTableNames: true,
autoQuoteFieldNames: true
});
s.run = () => {
let p = s.toParam();
return self.query(p.text, p.values);
};
return s;
};
};
let buildSelf = {
select: wrap('select'),
update: wrap('update'),
delete: wrap('delete'),
insert: wrap('insert')
};
return buildSelf;
};
self.query = function (statementRaw, values) {

@@ -130,0 +161,0 @@ let statementObject = getStatementObject(statementRaw);

'use strict';
let _ = require('lodash');
let Q = require('q');
let chai = require('chai');
let config = require('../config');
let mysql = require('mysql');
let createNodeMySQL = require('../src/mysql-wrap');
const _ = require('lodash');
const Q = require('q');
const chai = require('chai');
const config = require('../config');
const mysql = require('mysql');
const createNodeMySQL = require('../src/mysql-wrap');

@@ -54,2 +54,12 @@ describe('mysqlWrap', function () {

describe('build', function () {
it('should return query generator', function (done) {
this.sql.build().select().from('table').where('field = ?', 'bar').run()
.then(resp => {
chai.assert.deepEqual(resp, [this.b]);
done();
}).done();
});
});
describe('queryStream', function () {

@@ -56,0 +66,0 @@ it('should return a readable stream of rows', function (done) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc