@zenorm/generate 2.3.0 → 2.5.0

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/generate.js CHANGED
@@ -28,8 +28,6 @@ async function generate(tables, cfg) {
28
28
  const remark = [
29
29
  '// zenorm 自动生成文件',
30
30
  '// 请不要修改此文件,因为此文件在每次重新生成数据库结构时会被覆盖',
31
- `// create at: ${(0, utils_1.currentDatetime)()}`,
32
- `// create by: ${process.env.USER || process.env.USERNAME || '-'}@${process.env.COMPUTERNAME || '-'}`,
33
31
  `// database: ${config.database}`,
34
32
  ];
35
33
  const structs = [
@@ -134,6 +132,7 @@ async function generate(tables, cfg) {
134
132
  repositories.push(` static repository = ${className}.query(_query);`);
135
133
  // 静态方法
136
134
  if (config.staticMethods) {
135
+ // 静态函数
137
136
  repositories.push(...[
138
137
  'of',
139
138
  'find',
@@ -148,6 +147,11 @@ async function generate(tables, cfg) {
148
147
  'update',
149
148
  'delete',
150
149
  ].map(i => ` static ${i}: typeof ${className}.repository.${i} = ${className}.repository.${i}.bind(${className}.repository);`));
150
+ // 静态属性
151
+ repositories.push(...[
152
+ 'master',
153
+ 'slave',
154
+ ].map(i => ` static ${i} = ${className}.repository.${i};`));
151
155
  }
152
156
  // 实例方法
153
157
  if (config.instanceMethods) {
package/dist/utils.d.ts CHANGED
@@ -7,4 +7,3 @@ export declare function fileExists(f: string): Promise<boolean>;
7
7
  * @param getContent
8
8
  */
9
9
  export declare function notExistsPut(filename: string, getContent: () => string | Promise<string>): Promise<boolean>;
10
- export declare function currentDatetime(): string;
package/dist/utils.js CHANGED
@@ -7,7 +7,6 @@ exports.cwdPath = cwdPath;
7
7
  exports.checkFileDir = checkFileDir;
8
8
  exports.fileExists = fileExists;
9
9
  exports.notExistsPut = notExistsPut;
10
- exports.currentDatetime = currentDatetime;
11
10
  const node_fs_1 = require("node:fs");
12
11
  const node_path_1 = __importDefault(require("node:path"));
13
12
  function cwdPath(p) {
@@ -34,6 +33,3 @@ async function notExistsPut(filename, getContent) {
34
33
  }
35
34
  return false;
36
35
  }
37
- function currentDatetime() {
38
- return new Date().toLocaleString();
39
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zenorm/generate",
3
3
  "description": "Easy ORM, easy query. easy typing! Auto generate typescript declaration.",
4
- "version": "2.3.0",
4
+ "version": "2.5.0",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "homepage": "https://zenorm.node.ltd",
@@ -35,7 +35,7 @@
35
35
  "rimraf": "^4.4.1",
36
36
  "ts-node": "^10.9.2",
37
37
  "typescript": "^6.0.3",
38
- "zenorm": "^4.5.0"
38
+ "zenorm": "^4.6.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "pascal-case": "^3.1.2",