From 2e99ab8ce872b8482fe2b0a29af51a7a99aaff84 Mon Sep 17 00:00:00 2001 From: Haoliang Gao Date: Thu, 16 Jul 2020 20:35:29 +0800 Subject: [PATCH] feat: export sqlstring method (#79) --- .travis.yml | 2 ++ lib/client.js | 4 ++++ package.json | 2 +- test/client.test.js | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 88dc295..b76bad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ node_js: - '6' - '8' - '10' + - '12' + - '14' install: - npm i npminstall && npminstall before_script: diff --git a/lib/client.js b/lib/client.js index a886789..b486753 100644 --- a/lib/client.js +++ b/lib/client.js @@ -10,6 +10,10 @@ const promisify = require('pify'); module.exports = RDSClient; module.exports.literals = require('./literals'); +module.exports.escape = mysql.escape; +module.exports.escapeId = mysql.escapeId; +module.exports.format = mysql.format; +module.exports.raw = mysql.raw; function RDSClient(options) { if (!(this instanceof RDSClient)) { diff --git a/package.json b/package.json index db01a22..196285c 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "eslint": "^3.19.0", "eslint-config-egg": "^3.2.0", "istanbul": "*", - "mocha": "*", + "mocha": "8", "thunk-mocha": "*" }, "homepage": "https://github.com/ali-sdk/ali-rds", diff --git a/test/client.test.js b/test/client.test.js index 5752a05..c1246dd 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -2,6 +2,7 @@ const co = require('co'); const assert = require('assert'); +const mysql = require('mysql'); const rds = require('../'); const config = require('./config'); @@ -901,4 +902,20 @@ describe('client.test.js', function() { }).catch(done); }); }); + + describe('export', () => { + it('export escape', function() { + assert(rds.escape && rds.escape === mysql.escape); + }); + it('export escapeId', function() { + assert(rds.escapeId && rds.escapeId === mysql.escapeId); + }); + it('export format', function() { + assert(rds.format && rds.format === mysql.format); + }); + it('export raw', function() { + assert(rds.raw && rds.raw === mysql.raw); + }); + }); + });