baja-lite 1.6.2 → 1.6.4

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.
Files changed (73) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc.cjs +89 -0
  3. package/.prettierrc +7 -0
  4. package/.vscode/settings.json +9 -0
  5. package/ci.js +33 -0
  6. package/package-cjs.json +17 -0
  7. package/package.json +80 -80
  8. package/pnpm-lock.yaml +2840 -0
  9. package/pnpm-workspace.yaml +2 -0
  10. package/{boot-remote.js → src/boot-remote.ts} +64 -63
  11. package/{boot.js → src/boot.ts} +170 -163
  12. package/{code.js → src/code.ts} +526 -517
  13. package/{convert-xml.js → src/convert-xml.ts} +460 -410
  14. package/src/error.ts +11 -0
  15. package/src/event.ts +34 -0
  16. package/src/fn.ts +295 -0
  17. package/{index.d.ts → src/index.ts} +11 -10
  18. package/src/math.ts +405 -0
  19. package/src/object.ts +342 -0
  20. package/{snowflake.js → src/snowflake.ts} +127 -108
  21. package/src/sql.ts +5529 -0
  22. package/{sqlite.js → src/sqlite.ts} +157 -156
  23. package/src/string.ts +111 -0
  24. package/src/test-mysql.ts +148 -0
  25. package/{test-postgresql.js → src/test-postgresql.ts} +80 -91
  26. package/{test-sqlite.js → src/test-sqlite.ts} +80 -90
  27. package/{test-xml.js → src/test-xml.ts} +70 -70
  28. package/{test.js → src/test.ts} +3 -2
  29. package/src/wx/base.ts +77 -0
  30. package/src/wx/mini.ts +147 -0
  31. package/src/wx/organ.ts +290 -0
  32. package/{wx/types.d.ts → src/wx/types.ts} +549 -560
  33. package/{wx.d.ts → src/wx.ts} +3 -3
  34. package/tsconfig.cjs.json +42 -0
  35. package/tsconfig.json +44 -0
  36. package/xml/event-report.xml +13 -0
  37. package/yarn.lock +1977 -0
  38. package/boot-remote.d.ts +0 -2
  39. package/boot.d.ts +0 -2
  40. package/code.d.ts +0 -2
  41. package/convert-xml.d.ts +0 -10
  42. package/error.d.ts +0 -5
  43. package/error.js +0 -13
  44. package/event.d.ts +0 -10
  45. package/event.js +0 -38
  46. package/fn.d.ts +0 -128
  47. package/fn.js +0 -172
  48. package/index.js +0 -10
  49. package/math.d.ts +0 -83
  50. package/math.js +0 -451
  51. package/object.d.ts +0 -126
  52. package/object.js +0 -321
  53. package/snowflake.d.ts +0 -12
  54. package/sql.d.ts +0 -2148
  55. package/sql.js +0 -5372
  56. package/sqlite.d.ts +0 -32
  57. package/string.d.ts +0 -17
  58. package/string.js +0 -105
  59. package/test-mysql.d.ts +0 -2
  60. package/test-mysql.js +0 -114
  61. package/test-postgresql.d.ts +0 -2
  62. package/test-sqlite.d.ts +0 -1
  63. package/test-xml.d.ts +0 -1
  64. package/test.d.ts +0 -1
  65. package/wx/base.d.ts +0 -11
  66. package/wx/base.js +0 -78
  67. package/wx/mini.d.ts +0 -52
  68. package/wx/mini.js +0 -112
  69. package/wx/organ.d.ts +0 -65
  70. package/wx/organ.js +0 -171
  71. package/wx/types.js +0 -1
  72. package/wx.js +0 -3
  73. /package/{README.md → Readme.md} +0 -0
@@ -0,0 +1,2 @@
1
+ ignoredBuiltDependencies:
2
+ - better-sqlite3
@@ -1,63 +1,64 @@
1
- import { DBType, _Hump, getEnums } from 'baja-lite-field';
2
- import { ColumnMode, SqlCache, SqliteRemote, _DataConvert, _GlobalSqlOption, _dao, _defOption, _enum, _primaryDB, _sqlCache, logger } from './sql.js';
3
- export const BootRomote = async function (options) {
4
- globalThis[_GlobalSqlOption] = Object.assign({}, _defOption);
5
- if (options.skipEmptyString !== undefined) {
6
- globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
7
- }
8
- if (options.skipNull !== undefined) {
9
- globalThis[_GlobalSqlOption].skipNull = options.skipNull;
10
- }
11
- if (options.skipEmptyString !== undefined) {
12
- globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
13
- }
14
- if (options.maxDeal !== undefined) {
15
- globalThis[_GlobalSqlOption].maxDeal = options.maxDeal;
16
- }
17
- if (options.SqliteRemote !== undefined) {
18
- globalThis[_GlobalSqlOption].SqliteRemote = options.SqliteRemote;
19
- }
20
- globalThis[_Hump] = options.columnMode === ColumnMode.HUMP;
21
- logger.level = options.log ?? 'info';
22
- globalThis[_sqlCache] = new SqlCache();
23
- if (options.sqlMap) {
24
- await globalThis[_sqlCache].init(options);
25
- }
26
- globalThis[_dao] = {
27
- [DBType.SqliteRemote]: {},
28
- };
29
- if (options.enums) {
30
- globalThis[_enum] = getEnums(options.enums);
31
- }
32
- if (options.dataConvert) {
33
- globalThis[_DataConvert] = options.dataConvert;
34
- }
35
- if (options.SqliteRemote && options.SqliteRemote.db) {
36
- if (typeof options.SqliteRemote.db === 'string') {
37
- options.SqliteRemote.service.initDB(options.SqliteRemote.db);
38
- globalThis[_dao][DBType.SqliteRemote][_primaryDB] = new SqliteRemote(options.SqliteRemote.service, options.SqliteRemote.db);
39
- }
40
- else {
41
- let flag = false;
42
- for (const [key, fileName] of Object.entries(options.SqliteRemote.db)) {
43
- await options.SqliteRemote.service.initDB(fileName);
44
- const db = new SqliteRemote(options.SqliteRemote.service, fileName);
45
- if (flag === false) {
46
- globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
47
- flag = true;
48
- }
49
- globalThis[_dao][DBType.SqliteRemote][key] = db;
50
- }
51
- }
52
- }
53
- };
54
- // export const AppendRomote = async function (dbName: string) {
55
- // if (!globalThis[_dao][DBType.SqliteRemote][dbName]) {
56
- // globalThis[_GlobalSqlOption].SqliteRemote.service.initDB(dbName);
57
- // const db = new SqliteRemote(globalThis[_GlobalSqlOption].SqliteRemote.service, dbName);
58
- // if (globalThis[_dao][DBType.SqliteRemote][_primaryDB] === undefined) {
59
- // globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
60
- // }
61
- // globalThis[_dao][DBType.SqliteRemote][dbName] = db;
62
- // }
63
- // }
1
+ import { DBType, _Hump, getEnums } from 'baja-lite-field';
2
+ import { ColumnMode, GlobalSqlOptionForWeb, SqlCache, SqliteRemote, _DataConvert, _GlobalSqlOption, _dao, _defOption, _enum, _primaryDB, _sqlCache, logger } from './sql.js';
3
+
4
+ export const BootRomote = async function (options: GlobalSqlOptionForWeb) {
5
+ globalThis[_GlobalSqlOption] = Object.assign({}, _defOption);
6
+ if(options.skipEmptyString !== undefined){
7
+ globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
8
+ }
9
+ if(options.skipNull !== undefined){
10
+ globalThis[_GlobalSqlOption].skipNull = options.skipNull;
11
+ }
12
+ if(options.skipEmptyString !== undefined){
13
+ globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
14
+ }
15
+ if(options.maxDeal !== undefined){
16
+ globalThis[_GlobalSqlOption].maxDeal = options.maxDeal;
17
+ }
18
+ if(options.SqliteRemote !== undefined){
19
+ globalThis[_GlobalSqlOption].SqliteRemote = options.SqliteRemote;
20
+ }
21
+ globalThis[_Hump] = options.columnMode === ColumnMode.HUMP;
22
+ logger.level = options.log ?? 'info';
23
+ globalThis[_sqlCache] = new SqlCache();
24
+ if (options.sqlMap) {
25
+ await globalThis[_sqlCache].init(options);
26
+ }
27
+ globalThis[_dao] = {
28
+ [DBType.SqliteRemote]: {},
29
+ };
30
+ if (options.enums) {
31
+ globalThis[_enum] = getEnums(options.enums);
32
+ }
33
+ if (options.dataConvert) {
34
+ globalThis[_DataConvert] = options.dataConvert;
35
+ }
36
+ if (options.SqliteRemote && options.SqliteRemote.db) {
37
+ if (typeof options.SqliteRemote.db === 'string') {
38
+ options.SqliteRemote.service.initDB(options.SqliteRemote.db);
39
+ globalThis[_dao][DBType.SqliteRemote][_primaryDB] = new SqliteRemote(options.SqliteRemote.service, options.SqliteRemote.db);
40
+ } else {
41
+ let flag = false;
42
+ for (const [key, fileName] of Object.entries(options.SqliteRemote.db)) {
43
+ await options.SqliteRemote.service.initDB(fileName);
44
+ const db = new SqliteRemote(options.SqliteRemote.service, fileName);
45
+ if (flag === false) {
46
+ globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
47
+ flag = true;
48
+ }
49
+ globalThis[_dao][DBType.SqliteRemote][key] = db;
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ // export const AppendRomote = async function (dbName: string) {
56
+ // if (!globalThis[_dao][DBType.SqliteRemote][dbName]) {
57
+ // globalThis[_GlobalSqlOption].SqliteRemote.service.initDB(dbName);
58
+ // const db = new SqliteRemote(globalThis[_GlobalSqlOption].SqliteRemote.service, dbName);
59
+ // if (globalThis[_dao][DBType.SqliteRemote][_primaryDB] === undefined) {
60
+ // globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
61
+ // }
62
+ // globalThis[_dao][DBType.SqliteRemote][dbName] = db;
63
+ // }
64
+ // }
@@ -1,163 +1,170 @@
1
- import { _Hump, DBType, getEnums } from 'baja-lite-field';
2
- import events from 'events';
3
- import { _dao, _DataConvert, _defOption, _enum, _EventBus, _fs, _GlobalSqlOption, _path, _primaryDB, _sqlCache, ColumnMode, logger, Mysql, Postgresql, SqlCache, Sqlite, SqliteRemote } from './sql.js';
4
- export const Boot = async function (options) {
5
- globalThis[_GlobalSqlOption] = Object.assign({}, _defOption);
6
- if (options.skipEmptyString !== undefined) {
7
- globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
8
- }
9
- if (options.skipNull !== undefined) {
10
- globalThis[_GlobalSqlOption].skipNull = options.skipNull;
11
- }
12
- if (options.skipEmptyString !== undefined) {
13
- globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
14
- }
15
- if (options.maxDeal !== undefined) {
16
- globalThis[_GlobalSqlOption].maxDeal = options.maxDeal;
17
- }
18
- globalThis[_Hump] = options.columnMode === ColumnMode.HUMP;
19
- logger.level = options.log ?? 'info';
20
- globalThis[_sqlCache] = new SqlCache();
21
- if (options.sqlDir) {
22
- globalThis[_path] = await import('path');
23
- globalThis[_fs] = await import('fs');
24
- }
25
- if (options.sqlMap || options.sqlDir) {
26
- await globalThis[_sqlCache].init(options);
27
- }
28
- globalThis[_dao] = {
29
- [DBType.Mongo]: {},
30
- [DBType.Mysql]: {},
31
- [DBType.Postgresql]: {},
32
- [DBType.Sqlite]: {},
33
- [DBType.SqliteRemote]: {},
34
- [DBType.Redis]: {}
35
- };
36
- if (options.enums) {
37
- globalThis[_enum] = getEnums(options.enums);
38
- }
39
- if (options.dataConvert) {
40
- globalThis[_DataConvert] = options.dataConvert;
41
- }
42
- if (options.Mysql) {
43
- const { createPool } = await import('mysql2/promise');
44
- if (options.Mysql['host']) {
45
- globalThis[_dao][DBType.Mysql][_primaryDB] = new Mysql(createPool({
46
- ...options.Mysql,
47
- multipleStatements: true,
48
- decimalNumbers: true,
49
- supportBigNumbers: true
50
- }));
51
- }
52
- else {
53
- let flag = false;
54
- for (const [key, option] of Object.entries(options.Mysql)) {
55
- const db = new Mysql(createPool({
56
- ...option,
57
- multipleStatements: true,
58
- decimalNumbers: true,
59
- supportBigNumbers: true
60
- }));
61
- if (!flag) {
62
- globalThis[_dao][DBType.Mysql][_primaryDB] = db;
63
- flag = true;
64
- }
65
- globalThis[_dao][DBType.Mysql][key] = db;
66
- }
67
- }
68
- }
69
- if (options.Sqlite) {
70
- if (typeof options.Sqlite === 'string') {
71
- globalThis[_dao][DBType.Sqlite][_primaryDB] = new Sqlite(new options.BetterSqlite3(options.Sqlite, { fileMustExist: false }));
72
- }
73
- else {
74
- let flag = false;
75
- for (const [key, fileName] of Object.entries(options.Sqlite)) {
76
- const db = new Sqlite(new options.BetterSqlite3(fileName, { fileMustExist: false }));
77
- if (!flag) {
78
- globalThis[_dao][DBType.Sqlite][_primaryDB] = db;
79
- flag = true;
80
- }
81
- globalThis[_dao][DBType.Sqlite][key] = db;
82
- }
83
- }
84
- }
85
- if (options.SqliteRemote && options.SqliteRemote.db) {
86
- if (typeof options.SqliteRemote.db === 'string') {
87
- options.SqliteRemote.service.initDB(options.SqliteRemote.db);
88
- globalThis[_dao][DBType.SqliteRemote][_primaryDB] = new SqliteRemote(options.SqliteRemote.service, options.SqliteRemote.db);
89
- }
90
- else {
91
- let flag = false;
92
- for (const [key, fileName] of Object.entries(options.SqliteRemote.db)) {
93
- options.SqliteRemote.service.initDB(fileName);
94
- const db = new SqliteRemote(options.SqliteRemote.service, fileName);
95
- if (!flag) {
96
- globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
97
- flag = true;
98
- }
99
- globalThis[_dao][DBType.SqliteRemote][key] = db;
100
- }
101
- }
102
- }
103
- if (options.Redis) {
104
- events.setMaxListeners(0);
105
- const { Redis } = await import('ioredis');
106
- if (options.Redis['host']) {
107
- globalThis[_dao][DBType.Redis][_primaryDB] = new Redis(options.Redis);
108
- }
109
- else {
110
- let flag = false;
111
- for (const [key, option] of Object.entries(options.Redis)) {
112
- const db = new Redis(option);
113
- if (!flag) {
114
- globalThis[_dao][DBType.Redis][_primaryDB] = db;
115
- flag = true;
116
- }
117
- globalThis[_dao][DBType.Redis][key] = db;
118
- }
119
- }
120
- const clients = Object.values(globalThis[_dao][DBType.Redis]);
121
- const Redlock = await import('redlock');
122
- globalThis[_dao][DBType.RedisLock] = new Redlock.default(clients, {
123
- // The expected clock drift; for more details see:
124
- // http://redis.io/topics/distlock
125
- driftFactor: 0.01, // multiplied by lock ttl to determine drift time
126
- // The max number of times Redlock will attempt to lock a resource
127
- // before erroring.
128
- retryCount: 10,
129
- // the time in ms between attempts
130
- retryDelay: 200, // time in ms
131
- // the max time in ms randomly added to retries
132
- // to improve performance under high contention
133
- // see https://www.awsarchitectureblog.com/2015/03/backoff.html
134
- retryJitter: 200, // time in ms
135
- // The minimum remaining time on a lock before an extension is automatically
136
- // attempted with the `using` API.
137
- automaticExtensionThreshold: 500, // time in ms
138
- });
139
- const { EventEmitter } = await import('events');
140
- const event = new EventEmitter({ captureRejections: true });
141
- event.on('error', error => {
142
- logger.error('event-bus', error);
143
- });
144
- globalThis[_EventBus] = event;
145
- }
146
- if (options.Postgresql) {
147
- const Pool = await import('pg-pool');
148
- if (options.Postgresql['host']) {
149
- globalThis[_dao][DBType.Postgresql][_primaryDB] = new Postgresql(new Pool.default(options.Postgresql));
150
- }
151
- else {
152
- let flag = false;
153
- for (const [key, option] of Object.entries(options.Postgresql)) {
154
- const db = new Postgresql(new Pool.default(option));
155
- if (!flag) {
156
- globalThis[_dao][DBType.Postgresql][_primaryDB] = db;
157
- flag = true;
158
- }
159
- globalThis[_dao][DBType.Postgresql][key] = db;
160
- }
161
- }
162
- }
163
- };
1
+ import { _Hump, DBType, getEnums } from 'baja-lite-field';
2
+ import events from 'events';
3
+ import { _dao, _DataConvert, _defOption, _enum, _EventBus, _fs, _GlobalSqlOption, _path, _primaryDB, _sqlCache, ColumnMode, GlobalSqlOption, logger, Mysql, Postgresql, SqlCache, Sqlite, SqliteRemote } from './sql.js';
4
+
5
+ export const Boot = async function (options: GlobalSqlOption) {
6
+ globalThis[_GlobalSqlOption] = Object.assign({}, _defOption);
7
+ if (options.skipEmptyString !== undefined) {
8
+ globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
9
+ }
10
+ if (options.skipNull !== undefined) {
11
+ globalThis[_GlobalSqlOption].skipNull = options.skipNull;
12
+ }
13
+ if (options.skipEmptyString !== undefined) {
14
+ globalThis[_GlobalSqlOption].skipEmptyString = options.skipEmptyString;
15
+ }
16
+ if (options.maxDeal !== undefined) {
17
+ globalThis[_GlobalSqlOption].maxDeal = options.maxDeal;
18
+ }
19
+ globalThis[_Hump] = options.columnMode === ColumnMode.HUMP;
20
+ logger.level = options.log ?? 'info';
21
+ globalThis[_sqlCache] = new SqlCache();
22
+ if (options.sqlDir) {
23
+ globalThis[_path] = await import('path');
24
+ globalThis[_fs] = await import('fs');
25
+ }
26
+ if (options.sqlMap || options.sqlDir) {
27
+ await globalThis[_sqlCache].init(options);
28
+ }
29
+ globalThis[_dao] = {
30
+ [DBType.Mongo]: {},
31
+ [DBType.Mysql]: {},
32
+ [DBType.Postgresql]: {},
33
+ [DBType.Sqlite]: {},
34
+ [DBType.SqliteRemote]: {},
35
+ [DBType.Redis]: {}
36
+ };
37
+ if (options.enums) {
38
+ globalThis[_enum] = getEnums(options.enums);
39
+ }
40
+ if (options.dataConvert) {
41
+ globalThis[_DataConvert] = options.dataConvert;
42
+ }
43
+ if (options.Mysql) {
44
+ const { createPool } = await import('mysql2/promise');
45
+ if (options.Mysql['host']) {
46
+ globalThis[_dao][DBType.Mysql][_primaryDB] = new Mysql(createPool({
47
+ ...options.Mysql,
48
+ multipleStatements: true,
49
+ decimalNumbers: true,
50
+ supportBigNumbers: true
51
+ }));
52
+ }
53
+ else {
54
+ let flag = false;
55
+ for (const [key, option] of Object.entries(options.Mysql)) {
56
+ const db = new Mysql(createPool({
57
+ ...option,
58
+ multipleStatements: true,
59
+ decimalNumbers: true,
60
+ supportBigNumbers: true
61
+ }));
62
+ if (!flag) {
63
+ globalThis[_dao][DBType.Mysql][_primaryDB] = db;
64
+ flag = true;
65
+ }
66
+ globalThis[_dao][DBType.Mysql][key] = db;
67
+ }
68
+ }
69
+ }
70
+ if (options.Sqlite) {
71
+ if (typeof options.Sqlite === 'string') {
72
+ globalThis[_dao][DBType.Sqlite][_primaryDB] = new Sqlite(new options.BetterSqlite3(options.Sqlite, { fileMustExist: false }));
73
+ } else {
74
+ let flag = false;
75
+ for (const [key, fileName] of Object.entries(options.Sqlite)) {
76
+ const db = new Sqlite(new options.BetterSqlite3(fileName, { fileMustExist: false }));
77
+ if (!flag) {
78
+ globalThis[_dao][DBType.Sqlite][_primaryDB] = db;
79
+ flag = true;
80
+ }
81
+ globalThis[_dao][DBType.Sqlite][key] = db;
82
+ }
83
+ }
84
+ }
85
+ if (options.SqliteRemote && options.SqliteRemote.db) {
86
+ if (typeof options.SqliteRemote.db === 'string') {
87
+ options.SqliteRemote.service.initDB(options.SqliteRemote.db);
88
+ globalThis[_dao][DBType.SqliteRemote][_primaryDB] = new SqliteRemote(options.SqliteRemote.service, options.SqliteRemote.db);
89
+ }
90
+ else {
91
+ let flag = false;
92
+ for (const [key, fileName] of Object.entries(options.SqliteRemote.db)) {
93
+ options.SqliteRemote.service.initDB(fileName);
94
+ const db = new SqliteRemote(options.SqliteRemote.service, fileName);
95
+ if (!flag) {
96
+ globalThis[_dao][DBType.SqliteRemote][_primaryDB] = db;
97
+ flag = true;
98
+ }
99
+ globalThis[_dao][DBType.SqliteRemote][key] = db;
100
+ }
101
+ }
102
+ }
103
+ if (options.Redis) {
104
+ events.setMaxListeners(0);
105
+ const { Redis } = await import('ioredis');
106
+ if (options.Redis['host']) {
107
+ globalThis[_dao][DBType.Redis][_primaryDB] = new Redis(options.Redis);
108
+ }
109
+ else {
110
+ let flag = false;
111
+ for (const [key, option] of Object.entries(options.Redis)) {
112
+ const db = new Redis(option);
113
+ if (!flag) {
114
+ globalThis[_dao][DBType.Redis][_primaryDB] = db;
115
+ flag = true;
116
+ }
117
+ globalThis[_dao][DBType.Redis][key] = db;
118
+ }
119
+ }
120
+ const clients = Object.values(globalThis[_dao][DBType.Redis]) as any;
121
+ const Redlock = await import('redlock');
122
+ globalThis[_dao][DBType.RedisLock] = new Redlock.default(
123
+ clients,
124
+ {
125
+ // The expected clock drift; for more details see:
126
+ // http://redis.io/topics/distlock
127
+ driftFactor: 0.01, // multiplied by lock ttl to determine drift time
128
+
129
+ // The max number of times Redlock will attempt to lock a resource
130
+ // before erroring.
131
+ retryCount: 10,
132
+
133
+ // the time in ms between attempts
134
+ retryDelay: 200, // time in ms
135
+
136
+ // the max time in ms randomly added to retries
137
+ // to improve performance under high contention
138
+ // see https://www.awsarchitectureblog.com/2015/03/backoff.html
139
+ retryJitter: 200, // time in ms
140
+
141
+ // The minimum remaining time on a lock before an extension is automatically
142
+ // attempted with the `using` API.
143
+ automaticExtensionThreshold: 500, // time in ms
144
+ }
145
+ );
146
+ const { EventEmitter } = await import('events');
147
+ const event = new EventEmitter({ captureRejections: true });
148
+ event.on('error', error => {
149
+ logger.error('event-bus', error);
150
+ });
151
+ globalThis[_EventBus] = event;
152
+ }
153
+ if (options.Postgresql) {
154
+ const Pool = await import('pg-pool');
155
+ if (options.Postgresql['host']) {
156
+ globalThis[_dao][DBType.Postgresql][_primaryDB] = new Postgresql(new Pool.default(options.Postgresql));
157
+ }
158
+ else {
159
+ let flag = false;
160
+ for (const [key, option] of Object.entries(options.Postgresql)) {
161
+ const db = new Postgresql(new Pool.default(option));
162
+ if (!flag) {
163
+ globalThis[_dao][DBType.Postgresql][_primaryDB] = db;
164
+ flag = true;
165
+ }
166
+ globalThis[_dao][DBType.Postgresql][key] = db;
167
+ }
168
+ }
169
+ }
170
+ }