oak-db 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,18 +192,18 @@ class MysqlStore extends CascadeStore_1.CascadeStore {
192
192
  const rel = (0, relation_1.judgeRelation)(schema, e, attr);
193
193
  if (rel === 2) {
194
194
  // 边界,如果是toModi的对象,这里的外键确实有可能为空
195
- (0, assert_1.default)(schema[e].toModi || r.entity !== attr || r.entityId === r[attr].id, `对象${e}取数据时,发现entityId与连接的对象的主键不一致,rowId是${r.id},其entityId值为${r.entityId},连接的对象的主键为${r[attr].id}`);
195
+ // assert(schema[e].toModi || r.entity !== attr || r.entityId === r[attr].id, `对象${<string>e}取数据时,发现entityId与连接的对象的主键不一致,rowId是${r.id},其entityId值为${r.entityId},连接的对象的主键为${r[attr].id}`);
196
196
  if (r[attr].id === null) {
197
197
  (0, assert_1.default)(schema[e].toModi || r.entity !== attr);
198
198
  delete r[attr];
199
199
  continue;
200
200
  }
201
- (0, assert_1.default)(r.entity === attr, `对象${e}取数据时,发现entity值与连接的外键对象不一致,rowId是${r.id},其entity值为${r.entity},连接的对象为${attr}`);
201
+ // assert(r.entity === attr, `对象${<string>e}取数据时,发现entity值与连接的外键对象不一致,rowId是${r.id},其entity值为${r.entity},连接的对象为${attr}`);
202
202
  removeNullObjects(r[attr], attr);
203
203
  }
204
204
  else if (typeof rel === 'string') {
205
205
  // 边界,如果是toModi的对象,这里的外键确实有可能为空
206
- (0, assert_1.default)(schema[e].toModi || r[`${attr}Id`] === r[attr].id, `对象${e}取数据时,发现其外键与连接的对象的主键不一致,rowId是${r.id},其${attr}Id值为${r[`${attr}Id`]},连接的对象的主键为${r[attr].id}`);
206
+ // assert(schema[e].toModi || r[`${attr}Id`] === r[attr].id, `对象${<string>e}取数据时,发现其外键与连接的对象的主键不一致,rowId是${r.id},其${attr}Id值为${r[`${attr}Id`]},连接的对象的主键为${r[attr].id}`);
207
207
  if (r[attr].id === null) {
208
208
  (0, assert_1.default)(schema[e].toModi || r[`${attr}Id`] === null);
209
209
  delete r[attr];
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const util_1 = require("util");
7
7
  const lodash_1 = require("lodash");
8
+ const types_1 = require("oak-domain/lib/types");
8
9
  const sqlTranslator_1 = require("../sqlTranslator");
9
10
  const GeoTypes = [
10
11
  {
@@ -920,9 +921,12 @@ class MySqlTranslator extends sqlTranslator_1.SqlTranslator {
920
921
  }
921
922
  return sql;
922
923
  }
923
- const now = Date.now();
924
- const updateText2 = updateText ? `${updateText}, \`${alias}\`.\`$$deleteAt$$\` = '${now}'` : `\`${alias}\`.\`$$deleteAt$$\` = '${now}'`;
925
- let sql = `update ${fromText} set ${updateText2}`;
924
+ // 新的remove应该包含$$deleteAt$$的值了
925
+ /* const now = Date.now();
926
+
927
+ const updateText2 = updateText ? `${updateText}, \`${alias}\`.\`$$deleteAt$$\` = '${now}'` : `\`${alias}\`.\`$$deleteAt$$\` = '${now}'`; */
928
+ (0, assert_1.default)(updateText.includes(types_1.DeleteAtAttribute));
929
+ let sql = `update ${fromText} set ${updateText}`;
926
930
  if (filterText) {
927
931
  sql += ` where ${filterText}`;
928
932
  }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './MySQL/store';
2
- export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
1
+ export * from './MySQL/store';
2
+ export { MySqlSelectOption, MysqlOperateOption } from './MySQL/translator';
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./MySQL/store"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./MySQL/store"), exports);