@itrocks/mysql 0.0.13 → 0.0.14
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/cjs/mysql.js +4 -1
- package/esm/mysql.js +4 -1
- package/package.json +1 -1
package/cjs/mysql.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.mysqlDependsOn = mysqlDependsOn;
|
|
|
5
5
|
const class_type_1 = require("@itrocks/class-type");
|
|
6
6
|
const class_type_2 = require("@itrocks/class-type");
|
|
7
7
|
const class_type_3 = require("@itrocks/class-type");
|
|
8
|
+
const property_type_1 = require("@itrocks/property-type");
|
|
8
9
|
const reflect_1 = require("@itrocks/reflect");
|
|
9
10
|
const reflect_2 = require("@itrocks/reflect");
|
|
10
11
|
const storage_1 = require("@itrocks/storage");
|
|
@@ -109,7 +110,9 @@ class Mysql extends storage_1.DataSource {
|
|
|
109
110
|
const sql = ['id'];
|
|
110
111
|
for (const property of new reflect_1.ReflectClass(type).properties) {
|
|
111
112
|
const propertyType = property.type;
|
|
112
|
-
|
|
113
|
+
if (propertyType instanceof property_type_1.CollectionType)
|
|
114
|
+
continue;
|
|
115
|
+
const propertyName = ((0, class_type_2.isAnyType)(propertyType.type) && depends.storeOf(propertyType.type))
|
|
113
116
|
? property.name + 'Id'
|
|
114
117
|
: property.name;
|
|
115
118
|
const columnName = depends.columnOf(propertyName);
|
package/esm/mysql.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isAnyFunction } from '@itrocks/class-type';
|
|
2
2
|
import { isAnyType } from '@itrocks/class-type';
|
|
3
3
|
import { typeOf } from '@itrocks/class-type';
|
|
4
|
+
import { CollectionType } from '@itrocks/property-type';
|
|
4
5
|
import { ReflectClass } from '@itrocks/reflect';
|
|
5
6
|
import { ReflectProperty } from '@itrocks/reflect';
|
|
6
7
|
import { DataSource } from '@itrocks/storage';
|
|
@@ -105,7 +106,9 @@ export class Mysql extends DataSource {
|
|
|
105
106
|
const sql = ['id'];
|
|
106
107
|
for (const property of new ReflectClass(type).properties) {
|
|
107
108
|
const propertyType = property.type;
|
|
108
|
-
|
|
109
|
+
if (propertyType instanceof CollectionType)
|
|
110
|
+
continue;
|
|
111
|
+
const propertyName = (isAnyType(propertyType.type) && depends.storeOf(propertyType.type))
|
|
109
112
|
? property.name + 'Id'
|
|
110
113
|
: property.name;
|
|
111
114
|
const columnName = depends.columnOf(propertyName);
|
package/package.json
CHANGED