@axiosleo/orm-mysql 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/builder.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiosleo/orm-mysql",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "MySQL ORM tool",
5
5
  "keywords": [
6
6
  "mysql",
package/src/builder.js CHANGED
@@ -93,6 +93,9 @@ class Builder {
93
93
  }
94
94
 
95
95
  _buildTables(tables) {
96
+ if (!tables.length) {
97
+ throw new Error('At least one table is required');
98
+ }
96
99
  return tables.map((t) => {
97
100
  if (t.alias) {
98
101
  return `\`${t.tableName}\` AS \`${t.alias}\``;
@@ -192,7 +195,7 @@ class Builder {
192
195
  }
193
196
 
194
197
  _buildFieldWithTableName(key) {
195
- if (key.indexOf('$') !== -1 || key === '*') {
198
+ if (key.indexOf('$') !== -1 || key.indexOf('*') !== -1) {
196
199
  return key;
197
200
  }
198
201
  return key.split('.').map((k) => k.indexOf('`') !== -1 ? k : `\`${k}\``).join('.');