@asla/yoursql 0.6.4 → 0.6.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/dist/mod.js +3 -1
- package/dist/select/TableQuery.d.ts +2 -2
- package/package.json +1 -1
package/dist/mod.js
CHANGED
|
@@ -497,6 +497,7 @@ class SqlValuesCreator {
|
|
|
497
497
|
throw new Error("values 不能为空");
|
|
498
498
|
const insertKeys = Object.keys(valuesTypes);
|
|
499
499
|
const defaultValues = [];
|
|
500
|
+
const asserts = new Array(insertKeys.length);
|
|
500
501
|
const valuesStr = new Array(values.length);
|
|
501
502
|
{
|
|
502
503
|
const column0 = new Array(insertKeys.length);
|
|
@@ -515,6 +516,7 @@ class SqlValuesCreator {
|
|
|
515
516
|
else {
|
|
516
517
|
sqlType = item.sqlType;
|
|
517
518
|
assertJsType = item.assertJsType;
|
|
519
|
+
asserts[i] = assertJsType;
|
|
518
520
|
defaultValues[i] = item.sqlDefault ?? "NULL";
|
|
519
521
|
}
|
|
520
522
|
value = values[0][columnName];
|
|
@@ -533,7 +535,7 @@ class SqlValuesCreator {
|
|
|
533
535
|
if (value === undefined)
|
|
534
536
|
items[j] = defaultValues[j];
|
|
535
537
|
else
|
|
536
|
-
items[j] = this.toSqlStr(value);
|
|
538
|
+
items[j] = this.toSqlStr(value, asserts[j]);
|
|
537
539
|
}
|
|
538
540
|
valuesStr[i] = "(" + items.join(",") + ")";
|
|
539
541
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SqlValuesCreator
|
|
1
|
+
import { SqlValuesCreator } from "../sql_value/sql_value.ts";
|
|
2
2
|
import { ColumnsSelected, SelectColumns, UpdateRowValue, TableType } from "./type.ts";
|
|
3
3
|
import { CurrentWhere, Selection } from "./select.ts";
|
|
4
4
|
import { DbTable, SqlQueryStatement } from "./selectable.ts";
|
|
@@ -56,7 +56,7 @@ export declare class DbTableQuery<T extends TableType = Record<string, any>, C e
|
|
|
56
56
|
export interface InsertOption<T extends object> {
|
|
57
57
|
conflict?: (keyof T)[] | string;
|
|
58
58
|
updateValues?: Constructable<{
|
|
59
|
-
[key in keyof T]?: undefined |
|
|
59
|
+
[key in keyof T]?: undefined | String | T[key];
|
|
60
60
|
} | string | void>;
|
|
61
61
|
where?: Constructable<ConditionParam | void>;
|
|
62
62
|
}
|