mysql2-core 0.3.3 → 0.3.5
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/README.md +608 -1
- package/lib/build.js +93 -107
- package/lib/index.js +635 -849
- package/package.json +1 -1
- package/src/build.ts +5 -5
- package/tsconfig.json +4 -4
package/package.json
CHANGED
package/src/build.ts
CHANGED
|
@@ -4,7 +4,7 @@ export function param(i: number): string {
|
|
|
4
4
|
return "?"
|
|
5
5
|
}
|
|
6
6
|
export function params(length: number, from?: number): string[] {
|
|
7
|
-
if (from
|
|
7
|
+
if (from == null) {
|
|
8
8
|
from = 0
|
|
9
9
|
}
|
|
10
10
|
const ps: string[] = []
|
|
@@ -80,7 +80,7 @@ export function buildToSave<T>(obj: T, table: string, attrs: Attributes, ver?: s
|
|
|
80
80
|
pks.push(attr)
|
|
81
81
|
}
|
|
82
82
|
let v = o[k]
|
|
83
|
-
if (v
|
|
83
|
+
if (v == null) {
|
|
84
84
|
v = attr.default
|
|
85
85
|
}
|
|
86
86
|
if (v !== undefined && v != null && !attr.ignored && !attr.noinsert) {
|
|
@@ -134,7 +134,7 @@ export function buildToSave<T>(obj: T, table: string, attrs: Attributes, ver?: s
|
|
|
134
134
|
if (attr && !attr.key && !attr.ignored && !attr.noupdate) {
|
|
135
135
|
const field = attr.column ? attr.column : k
|
|
136
136
|
let x: string
|
|
137
|
-
if (v
|
|
137
|
+
if (v === null) {
|
|
138
138
|
x = "null"
|
|
139
139
|
} else if (v === "") {
|
|
140
140
|
x = `''`
|
|
@@ -183,7 +183,7 @@ export function buildToSaveBatch<T>(objs: T[], table: string, attrs: Attributes,
|
|
|
183
183
|
for (const k of ks) {
|
|
184
184
|
const attr = attrs[k]
|
|
185
185
|
let v = o[k]
|
|
186
|
-
if (v
|
|
186
|
+
if (v == null) {
|
|
187
187
|
v = attr.default
|
|
188
188
|
}
|
|
189
189
|
if (v != null && v !== undefined && !attr.ignored && !attr.noinsert) {
|
|
@@ -229,7 +229,7 @@ export function buildToSaveBatch<T>(objs: T[], table: string, attrs: Attributes,
|
|
|
229
229
|
if (attr && !attr.key && !attr.ignored && k !== ver && !attr.noupdate) {
|
|
230
230
|
const field = attr.column ? attr.column : k
|
|
231
231
|
let x: string
|
|
232
|
-
if (v
|
|
232
|
+
if (v === null) {
|
|
233
233
|
x = "null"
|
|
234
234
|
} else if (v === "") {
|
|
235
235
|
x = `''`
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compileOnSave": true,
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
5
|
-
"
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"rootDir": "./src",
|
|
6
6
|
"outDir": "./lib",
|
|
7
|
-
"module": "
|
|
8
|
-
"moduleResolution": "
|
|
7
|
+
"module": "node16",
|
|
8
|
+
"moduleResolution": "node16",
|
|
9
9
|
"strict": true,
|
|
10
10
|
"pretty": true,
|
|
11
11
|
"sourceMap": false,
|