baja-lite 1.3.24 → 1.3.26
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/code.js +25 -6
- package/package.json +2 -2
package/code.js
CHANGED
|
@@ -12,7 +12,7 @@ const lxMap = {
|
|
|
12
12
|
mediumint: "number",
|
|
13
13
|
int: "number",
|
|
14
14
|
integer: "number",
|
|
15
|
-
bigint: "
|
|
15
|
+
bigint: "number",
|
|
16
16
|
bit: "boolean",
|
|
17
17
|
double: "number",
|
|
18
18
|
real: "number",
|
|
@@ -24,7 +24,7 @@ const lxMap = {
|
|
|
24
24
|
date: "Date",
|
|
25
25
|
time: "string",
|
|
26
26
|
year: "string",
|
|
27
|
-
timestamp: "
|
|
27
|
+
timestamp: "number",
|
|
28
28
|
datetime: "Date",
|
|
29
29
|
tinyblob: "string",
|
|
30
30
|
blob: "string",
|
|
@@ -185,6 +185,7 @@ try {
|
|
|
185
185
|
else
|
|
186
186
|
delete r.notNull;
|
|
187
187
|
const fields = new Array(`type:SqlType.${r.type}`);
|
|
188
|
+
r.Type = lxMap[r.type];
|
|
188
189
|
if (r.length !== null) {
|
|
189
190
|
fields.push(`length:${r.length}`);
|
|
190
191
|
}
|
|
@@ -193,13 +194,32 @@ try {
|
|
|
193
194
|
}
|
|
194
195
|
if (r.def !== null) {
|
|
195
196
|
r.def ?? (r.def = '');
|
|
196
|
-
if (
|
|
197
|
-
|
|
197
|
+
if (r.def !== '') {
|
|
198
|
+
if (isNaN(r.def)) {
|
|
199
|
+
fields.push(`def:'${r.def}'`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
fields.push(`def:${r.def}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (r.Type === 'string') {
|
|
207
|
+
if (r.def === '' || r.def === null) {
|
|
208
|
+
r.def = "''";
|
|
198
209
|
}
|
|
199
210
|
else {
|
|
200
|
-
|
|
211
|
+
r.def = `'${r.def}'`;
|
|
201
212
|
}
|
|
202
213
|
}
|
|
214
|
+
else if (r.Type === 'number') {
|
|
215
|
+
r.def = 0;
|
|
216
|
+
}
|
|
217
|
+
else if (r.Type === 'Date') {
|
|
218
|
+
r.def = 'new Date()';
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
r.def = 'null';
|
|
222
|
+
}
|
|
203
223
|
if (r.id === true) {
|
|
204
224
|
fields.push(`id:true`);
|
|
205
225
|
}
|
|
@@ -217,7 +237,6 @@ try {
|
|
|
217
237
|
fields.push(`comment: '${r.comment}'`);
|
|
218
238
|
}
|
|
219
239
|
r.comment = r.comment ?? '';
|
|
220
|
-
r.Type = lxMap[r.type];
|
|
221
240
|
r.Field = `@Field({${fields.join(',')}})`;
|
|
222
241
|
r.Name = r.name.replace(/_(\w)/g, (a, b) => b.toUpperCase());
|
|
223
242
|
r.NAME = r.Name.replace(/\w/, (v) => v.toUpperCase());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baja-lite",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"description": "some util for self",
|
|
5
5
|
"homepage": "https://github.com/void-soul/util-man",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@msgpack/msgpack": "3.1.1",
|
|
39
39
|
"@types/request-promise": "4.1.51",
|
|
40
40
|
"axios": "1.8.4",
|
|
41
|
-
"baja-lite-field": "1.3.
|
|
41
|
+
"baja-lite-field": "1.3.21",
|
|
42
42
|
"decimal.js": "10.5.0",
|
|
43
43
|
"html-parse-stringify": "3.0.1",
|
|
44
44
|
"iterare": "1.2.1",
|