不要怂,就是干,撸起袖子干!

Commit 4c7b103d by Sushant Committed by GitHub

performance: remove terraformer-wkt-parser dependency (#9545)

1 parent 175c4e27
......@@ -3,7 +3,7 @@
const util = require('util');
const inherits = require('./utils/inherits');
const _ = require('lodash');
const Wkt = require('terraformer-wkt-parser');
const wkx = require('wkx');
const sequelizeErrors = require('./errors');
const warnings = {};
const Validator = require('./utils/validator-extras').validator;
......@@ -724,10 +724,10 @@ GEOMETRY.prototype.key = GEOMETRY.key = 'GEOMETRY';
GEOMETRY.prototype.escape = false;
GEOMETRY.prototype._stringify = function _stringify(value, options) {
return 'GeomFromText(' + options.escape(Wkt.convert(value)) + ')';
return 'GeomFromText(' + options.escape(wkx.Geometry.parseGeoJSON(value).toWkt()) + ')';
};
GEOMETRY.prototype._bindParam = function _bindParam(value, options) {
return 'GeomFromText(' + options.bindParam(Wkt.convert(value)) + ')';
return 'GeomFromText(' + options.bindParam(wkx.Geometry.parseGeoJSON(value).toWkt()) + ')';
};
function GEOGRAPHY(type, srid) {
......@@ -745,10 +745,10 @@ GEOGRAPHY.prototype.key = GEOGRAPHY.key = 'GEOGRAPHY';
GEOGRAPHY.prototype.escape = false;
GEOGRAPHY.prototype._stringify = function _stringify(value, options) {
return 'GeomFromText(' + options.escape(Wkt.convert(value)) + ')';
return 'GeomFromText(' + options.escape(wkx.Geometry.parseGeoJSON(value).toWkt()) + ')';
};
GEOGRAPHY.prototype._bindParam = function _bindParam(value, options) {
return 'GeomFromText(' + options.bindParam(Wkt.convert(value)) + ')';
return 'GeomFromText(' + options.bindParam(wkx.Geometry.parseGeoJSON(value).toWkt()) + ')';
};
for (const helper of Object.keys(helpers)) {
......
......@@ -14,8 +14,8 @@ class ConnectionManager extends AbstractConnectionManager {
constructor(dialect, sequelize) {
super(dialect, sequelize);
this.sequelize = sequelize;
this.sequelize.config.port = this.sequelize.config.port || 1433;
try {
if (sequelize.config.dialectModulePath) {
this.lib = require(sequelize.config.dialectModulePath);
......
......@@ -24,8 +24,8 @@ class ConnectionManager extends AbstractConnectionManager {
constructor(dialect, sequelize) {
super(dialect, sequelize);
this.sequelize = sequelize;
this.sequelize.config.port = this.sequelize.config.port || 3306;
try {
if (sequelize.config.dialectModulePath) {
this.lib = require(sequelize.config.dialectModulePath);
......
......@@ -14,8 +14,8 @@ class ConnectionManager extends AbstractConnectionManager {
constructor(dialect, sequelize) {
super(dialect, sequelize);
this.sequelize = sequelize;
this.sequelize.config.port = this.sequelize.config.port || 5432;
try {
let pgLib;
if (sequelize.config.dialectModulePath) {
......
......@@ -11,10 +11,7 @@ const parserStore = require('../parserStore')('sqlite');
class ConnectionManager extends AbstractConnectionManager {
constructor(dialect, sequelize) {
super(dialect, sequelize);
this.sequelize = sequelize;
this.config = sequelize.config;
this.dialect = dialect;
this.dialectName = this.sequelize.options.dialect;
this.connections = {};
// We attempt to parse file location from a connection uri but we shouldn't match sequelize default host.
......
......@@ -30,11 +30,10 @@
"moment-timezone": "^0.5.14",
"retry-as-promised": "^3.0.0",
"semver": "^5.5.0",
"terraformer-wkt-parser": "^1.1.2",
"toposort-class": "^1.0.1",
"uuid": "^3.2.1",
"validator": "^10.0.0",
"wkx": "^0.4.1"
"wkx": "^0.4.5"
},
"devDependencies": {
"@semantic-release/github": "^4.x",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!