oak-db 2.2.8 → 2.2.10

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.
@@ -625,6 +625,20 @@ var MySqlTranslator = /** @class */ (function (_super) {
625
625
  MySqlTranslator.prototype.populateRemoveStmt = function (removeText, fromText, aliasDict, filterText, sorterText, indexFrom, count, option) {
626
626
  // todo using index
627
627
  var alias = aliasDict['./'];
628
+ if (option === null || option === void 0 ? void 0 : option.deletePhysically) {
629
+ var sql_1 = "delete ".concat(alias, " from ").concat(fromText, " ");
630
+ if (filterText) {
631
+ sql_1 += " where ".concat(filterText);
632
+ }
633
+ if (sorterText) {
634
+ sql_1 += " order by ".concat(sorterText);
635
+ }
636
+ if (typeof indexFrom === 'number') {
637
+ (0, assert_1.default)(typeof count === 'number');
638
+ sql_1 += " limit ".concat(indexFrom, ", ").concat(count);
639
+ }
640
+ return sql_1;
641
+ }
628
642
  var now = Date.now();
629
643
  var sql = "update ".concat(fromText, " set `").concat(alias, "`.`$$deleteAt$$` = '").concat(now, "'");
630
644
  if (filterText) {
@@ -43,6 +43,7 @@ export declare abstract class SqlTranslator<ED extends EntityDict> {
43
43
  private translateProjection;
44
44
  private translateSelectInner;
45
45
  translateSelect<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
46
+ translateWhere<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: ED[T]['Selection'], option?: OP): string;
46
47
  translateAggregate<T extends keyof ED, OP extends SqlSelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option?: OP): string;
47
48
  translateCount<T extends keyof ED, OP extends SqlSelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option?: OP): string;
48
49
  translateRemove<T extends keyof ED, OP extends SqlOperateOption>(entity: T, operation: ED[T]['Remove'], option?: OP): string;
@@ -776,12 +776,17 @@ var SqlTranslator = /** @class */ (function () {
776
776
  return {
777
777
  stmt: this.populateSelectStmt(projText, fromText, aliasDict, filterText, sorterText, undefined, indexFrom, count, option, selection),
778
778
  currentNumber: currentNumber2,
779
+ filterStmt: filterText,
779
780
  };
780
781
  };
781
782
  SqlTranslator.prototype.translateSelect = function (entity, selection, option) {
782
783
  var stmt = this.translateSelectInner(entity, selection, 1, {}, option).stmt;
783
784
  return stmt;
784
785
  };
786
+ SqlTranslator.prototype.translateWhere = function (entity, selection, option) {
787
+ var filterStmt = this.translateSelectInner(entity, selection, 1, {}, option).filterStmt;
788
+ return filterStmt;
789
+ };
785
790
  SqlTranslator.prototype.translateAggregate = function (entity, aggregation, option) {
786
791
  var data = aggregation.data, filter = aggregation.filter, sorter = aggregation.sorter, indexFrom = aggregation.indexFrom, count = aggregation.count;
787
792
  var _a = this.analyzeJoin(entity, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-db",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "description": "oak-db",
5
5
  "main": "lib/index",
6
6
  "author": {
@@ -18,7 +18,7 @@
18
18
  "lodash": "^4.17.21",
19
19
  "mysql": "^2.18.1",
20
20
  "mysql2": "^2.3.3",
21
- "oak-domain": "^2.6.4",
21
+ "oak-domain": "^2.6.9",
22
22
  "uuid": "^8.3.2"
23
23
  },
24
24
  "license": "ISC",
@@ -29,7 +29,7 @@
29
29
  "@types/node": "^17.0.42",
30
30
  "@types/uuid": "^8.3.4",
31
31
  "mocha": "^10.0.0",
32
- "oak-general-business": "^2.5.4",
32
+ "oak-general-business": "^2.5.10",
33
33
  "ts-node": "~10.9.1",
34
34
  "tslib": "^2.4.0",
35
35
  "typescript": "~4.7.4"