@axiosleo/orm-mysql 0.2.2 → 0.2.3

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/query.js +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiosleo/orm-mysql",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "MySQL ORM tool",
5
5
  "keywords": [
6
6
  "mysql",
package/src/query.js CHANGED
@@ -11,7 +11,8 @@ class Query {
11
11
  operator,
12
12
  data: null,
13
13
  groupField: [],
14
- having: []
14
+ having: [],
15
+ joins: []
15
16
  };
16
17
  }
17
18
 
@@ -131,6 +132,15 @@ class Query {
131
132
  }
132
133
 
133
134
  join(table, alias, on, type) {
135
+ if (!alias) {
136
+ throw new Error('Alias is required');
137
+ }
138
+ if (!on) {
139
+ throw new Error('On is required');
140
+ }
141
+ if (['left', 'right', 'inner'].indexOf(type) === -1) {
142
+ throw new Error('Invalid join type : ' + type + '; only supported left, right, inner');
143
+ }
134
144
  this.options.joins.push({ table, alias, on, type });
135
145
  return this;
136
146
  }