@bunnykit/orm 0.1.9 → 0.1.10
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 +6 -1
- package/dist/src/typegen/TypeGenerator.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1219,7 +1219,12 @@ export interface UsersAttributes {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
1221
|
declare module "../User" {
|
|
1222
|
-
interface User
|
|
1222
|
+
interface User {
|
|
1223
|
+
id: number;
|
|
1224
|
+
name: string;
|
|
1225
|
+
email: string | null;
|
|
1226
|
+
created_at: string;
|
|
1227
|
+
}
|
|
1223
1228
|
}
|
|
1224
1229
|
```
|
|
1225
1230
|
|
|
@@ -36,7 +36,12 @@ export class TypeGenerator {
|
|
|
36
36
|
const modelDeclaration = this.getModelDeclaration(table, className, target.modelImportPrefix);
|
|
37
37
|
if (declarationOnly && modelDeclaration) {
|
|
38
38
|
lines.push(`declare module "${modelDeclaration.path}" {`);
|
|
39
|
-
lines.push(` interface ${modelDeclaration.className}
|
|
39
|
+
lines.push(` interface ${modelDeclaration.className} {`);
|
|
40
|
+
for (const col of columns) {
|
|
41
|
+
const tsType = TypeMapper.sqlToTsType(col.type, col.nullable);
|
|
42
|
+
lines.push(` ${col.name}${col.nullable ? "?" : ""}: ${tsType};`);
|
|
43
|
+
}
|
|
44
|
+
lines.push(" }");
|
|
40
45
|
lines.push("}");
|
|
41
46
|
lines.push("");
|
|
42
47
|
}
|
package/package.json
CHANGED