@rdyl/node-mysql 0.2.9 → 0.3.0

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 0.2.9 (2025-12-31)
1
+ # 0.3.0 (2025-12-31)
2
2
 
3
3
 
4
4
 
package/dist/helper.js CHANGED
@@ -107,12 +107,12 @@ var BaseHelper = /** @class */ (function () {
107
107
  else {
108
108
  sqlList.push("COALESCE(\n (\n SELECT JSON_OBJECT(".concat(fields
109
109
  .map(function (e) { return "".concat(e, ": ").concat(item.table, ".").concat(e); })
110
- .join(","), ")\n FROM ").concat(item.relatedTable, "\n JOIN ").concat(item.table, " ON ").concat(item.table, ".id = ").concat(item.relatedTable, ".").concat(item.table, "_id\n WHERE ").concat(item.relatedTable, ".").concat(_this.table, "_id = ").concat(_this.table, ".id\n LIMIT 1\n ),\n JSON_OBJECT()\n) AS role"));
110
+ .join(","), ")\n FROM ").concat(item.relatedTable, "\n JOIN ").concat(item.table, " ON ").concat(item.table, ".id = ").concat(item.relatedTable, ".").concat(item.table, "_id\n WHERE ").concat(item.relatedTable, ".").concat(_this.table, "_id = ").concat(_this.table, ".id\n LIMIT 1\n ),\n JSON_OBJECT()\n) AS role,\n"));
111
111
  }
112
112
  });
113
113
  }
114
114
  return {
115
- sql: sqlList.join(",\n"),
115
+ sql: sqlList.length > 0 ? "\n" : "" + sqlList.join("\n"),
116
116
  };
117
117
  },
118
118
  enumerable: false,
@@ -198,8 +198,8 @@ var MysqlSelector = /** @class */ (function (_super) {
198
198
  }
199
199
  Object.defineProperty(MysqlSelector.prototype, "sql", {
200
200
  get: function () {
201
- var _a = this, selectStat = _a.selectStat, optionStat = _a.optionStat;
202
- var target = "SELECT * FROM ".concat(this.table);
201
+ var _a = this, selectStat = _a.selectStat, optionStat = _a.optionStat, relatedStat = _a.relatedStat;
202
+ var target = "SELECT * ".concat(relatedStat.sql, "FROM ").concat(this.table);
203
203
  if (selectStat.sql) {
204
204
  target += selectStat.sql;
205
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdyl/node-mysql",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",