@axiosleo/orm-mysql 0.10.11 → 0.10.12
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 +4 -4
- package/package.json +1 -1
- package/src/builder.js +4 -4
- package/src/query.js +2 -1
package/bin/orm-mysql.js
CHANGED
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/builder.js
CHANGED
|
@@ -51,16 +51,16 @@ class Builder {
|
|
|
51
51
|
}
|
|
52
52
|
return attr;
|
|
53
53
|
});
|
|
54
|
-
emit(tmp, `SELECT ${attrs.length ? attrs.map((a) => this._buildFieldKey(a)).join(',') : '*'} FROM ${this._buildTables(options.tables)}`);
|
|
55
|
-
emit(tmp, this._buildJoins(options.joins));
|
|
56
|
-
emit(tmp, this._buildCondition(options.conditions));
|
|
57
|
-
emit(tmp, this._buildOrders(options.orders));
|
|
58
54
|
if (options.having && options.having.length && !options.groupField.length) {
|
|
59
55
|
throw new Error('having is not allowed without "GROUP BY"');
|
|
60
56
|
}
|
|
57
|
+
emit(tmp, `SELECT ${attrs.length ? attrs.map((a) => this._buildFieldKey(a)).join(',') : '*'} FROM ${this._buildTables(options.tables)}`);
|
|
58
|
+
emit(tmp, this._buildJoins(options.joins));
|
|
59
|
+
emit(tmp, this._buildCondition(options.conditions));
|
|
61
60
|
emit(tmp, this._buildGroupField(options.groupField));
|
|
62
61
|
emit(tmp, this._buildPagination(options.pageLimit, options.pageOffset));
|
|
63
62
|
emit(tmp, this._buildHaving(options.having));
|
|
63
|
+
emit(tmp, this._buildOrders(options.orders));
|
|
64
64
|
sql = tmp.join(' ');
|
|
65
65
|
if (options.suffix) {
|
|
66
66
|
sql += ' ' + options.suffix;
|
package/src/query.js
CHANGED
|
@@ -6,7 +6,8 @@ const is = require('@axiosleo/cli-tool/src/helper/is');
|
|
|
6
6
|
|
|
7
7
|
const optType = [
|
|
8
8
|
'=', '!=', '>', '<', '>=', '<=',
|
|
9
|
-
'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'IS', 'IS NOT',
|
|
9
|
+
'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'IS', 'IS NOT',
|
|
10
|
+
'REGEXP', 'NOT REGEXP', 'AND', 'OR', 'GROUP', 'CONTAIN', 'NOT CONTAIN', 'OVERLAPS', 'NOT OVERLAPS'
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
function joinOn(table, on, options = {}) {
|