@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 +1 -1
- package/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/builder.js +1 -1
- package/src/query.js +7 -0
package/bin/orm-mysql.js
CHANGED
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
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;
|