@axiosleo/orm-mysql 0.10.13 → 0.10.15

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/bin/orm-mysql.js CHANGED
@@ -9,7 +9,7 @@ const app = new App({
9
9
  name: 'MySQL ORM CLI',
10
10
  desc: 'migrate, model, seed, etc.',
11
11
  bin: 'orm-mysql',
12
- version: '0.10.13',
12
+ version: '0.10.15',
13
13
  commands_dir: path.join(__dirname, '../commands'),
14
14
  });
15
15
 
package/index.d.ts CHANGED
@@ -98,6 +98,8 @@ export declare class QueryCondition {
98
98
 
99
99
  where(key: string, opt: OptType, value: ConditionValueType | WhereOptions[], isOr?: boolean): this;
100
100
 
101
+ where(obj: Record<string, ConditionValueType>): this;
102
+
101
103
  whereAnd(): this;
102
104
 
103
105
  whereOr(): this;
@@ -124,6 +126,9 @@ export declare class QueryCondition {
124
126
 
125
127
  whereCondition(condition: QueryCondition): this;
126
128
 
129
+ /**
130
+ * @deprecated will deprecated on v1.0+ version
131
+ */
127
132
  whereObject(obj: Record<string, ConditionValueType>): this;
128
133
  }
129
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiosleo/orm-mysql",
3
- "version": "0.10.13",
3
+ "version": "0.10.15",
4
4
  "description": "MySQL ORM tool",
5
5
  "keywords": [
6
6
  "mysql",
package/src/builder.js CHANGED
@@ -58,9 +58,9 @@ class Builder {
58
58
  emit(tmp, this._buildJoins(options.joins));
59
59
  emit(tmp, this._buildCondition(options.conditions));
60
60
  emit(tmp, this._buildGroupField(options.groupField));
61
- emit(tmp, this._buildPagination(options.pageLimit, options.pageOffset));
62
61
  emit(tmp, this._buildHaving(options.having));
63
62
  emit(tmp, this._buildOrders(options.orders));
63
+ emit(tmp, this._buildPagination(options.pageLimit, options.pageOffset));
64
64
  sql = tmp.join(' ');
65
65
  if (options.suffix) {
66
66
  sql += ' ' + options.suffix;
package/src/query.js CHANGED
@@ -56,6 +56,13 @@ class QueryCondition {
56
56
  break;
57
57
  }
58
58
  case 1: {
59
+ if (is.object(args[0])) {
60
+ const obj = args[0];
61
+ Object.keys(obj).forEach((key) => {
62
+ this.options.conditions.push({ key, opt: '=', value: obj[key] });
63
+ });
64
+ break;
65
+ }
59
66
  const [opt] = args;
60
67
  this.options.conditions.push({ key: null, opt, value: null });
61
68
  break;