Skip to content

Commit

Permalink
feat: export sqlstring method (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored Jul 16, 2020
1 parent 9db39e6 commit 2e99ab8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ node_js:
- '6'
- '8'
- '10'
- '12'
- '14'
install:
- npm i npminstall && npminstall
before_script:
Expand Down
4 changes: 4 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const co = require('co');
const assert = require('assert');
const mysql = require('mysql');
const rds = require('../');
const config = require('./config');

Expand Down Expand Up @@ -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);
});
});

});

0 comments on commit 2e99ab8

Please sign in to comment.