@twin.org/entity-storage-connector-mysql 0.0.3-next.2 → 0.0.3-next.21
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 +7 -12
- package/dist/es/models/IMySqlEntityStorageConnectorConfig.js.map +1 -1
- package/dist/es/mysqlEntityStorageConnector.js +509 -119
- package/dist/es/mysqlEntityStorageConnector.js.map +1 -1
- package/dist/types/models/IMySqlEntityStorageConnectorConfig.d.ts +35 -0
- package/dist/types/mysqlEntityStorageConnector.d.ts +74 -8
- package/docs/changelog.md +440 -52
- package/docs/examples.md +105 -1
- package/docs/reference/classes/MySqlEntityStorageConnector.md +317 -26
- package/docs/reference/interfaces/IMySqlEntityStorageConnectorConfig.md +87 -7
- package/docs/reference/interfaces/IMySqlEntityStorageConnectorConstructorOptions.md +6 -6
- package/locales/en.json +17 -2
- package/package.json +6 -6
package/docs/examples.md
CHANGED
|
@@ -1 +1,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage Connector MySQL Examples
|
|
2
|
+
|
|
3
|
+
This page focuses on full connector lifecycle work, from initial bootstrap and entity access to schema maintenance and connection shutdown.
|
|
4
|
+
|
|
5
|
+
## MySqlEntityStorageConnector
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
MySqlEntityStorageConnector,
|
|
10
|
+
type IMySqlEntityStorageConnectorConstructorOptions
|
|
11
|
+
} from '@twin.org/entity-storage-connector-mysql';
|
|
12
|
+
import {
|
|
13
|
+
ComparisonOperator,
|
|
14
|
+
LogicalOperator,
|
|
15
|
+
SortDirection,
|
|
16
|
+
type EntityCondition
|
|
17
|
+
} from '@twin.org/entity';
|
|
18
|
+
|
|
19
|
+
interface Profile {
|
|
20
|
+
id: string;
|
|
21
|
+
email: string;
|
|
22
|
+
status: 'active' | 'inactive';
|
|
23
|
+
createdAt: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const options: IMySqlEntityStorageConnectorConstructorOptions = {
|
|
27
|
+
entitySchema: 'Profile',
|
|
28
|
+
config: {
|
|
29
|
+
host: 'localhost',
|
|
30
|
+
port: 3306,
|
|
31
|
+
user: 'root',
|
|
32
|
+
password: 'root',
|
|
33
|
+
database: 'entity_storage',
|
|
34
|
+
tableName: 'profiles'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const connector = new MySqlEntityStorageConnector<Profile>(options);
|
|
39
|
+
await connector.bootstrap();
|
|
40
|
+
|
|
41
|
+
const className = connector.className();
|
|
42
|
+
const schema = connector.getSchema();
|
|
43
|
+
|
|
44
|
+
await connector.set({
|
|
45
|
+
id: 'profile-1',
|
|
46
|
+
email: 'ada@example.com',
|
|
47
|
+
status: 'active',
|
|
48
|
+
createdAt: '2026-03-09T10:30:00.000Z'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const byPrimaryKey = await connector.get('profile-1');
|
|
52
|
+
const bySecondaryIndex = await connector.get('ada@example.com', 'email');
|
|
53
|
+
|
|
54
|
+
const activeCondition: EntityCondition<Profile> = {
|
|
55
|
+
logicalOperator: LogicalOperator.And,
|
|
56
|
+
conditions: [
|
|
57
|
+
{
|
|
58
|
+
property: 'status',
|
|
59
|
+
comparison: ComparisonOperator.Equals,
|
|
60
|
+
value: 'active'
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const result = await connector.query(
|
|
66
|
+
activeCondition,
|
|
67
|
+
[{ property: 'createdAt', sortDirection: SortDirection.Descending }],
|
|
68
|
+
['id', 'email', 'status'],
|
|
69
|
+
undefined,
|
|
70
|
+
25
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
await connector.remove('profile-1');
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { MySqlEntityStorageConnector } from '@twin.org/entity-storage-connector-mysql';
|
|
78
|
+
|
|
79
|
+
interface Profile {
|
|
80
|
+
id: string;
|
|
81
|
+
email: string;
|
|
82
|
+
status: 'active' | 'inactive';
|
|
83
|
+
createdAt: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const connector = new MySqlEntityStorageConnector<Profile>({
|
|
87
|
+
entitySchema: 'Profile',
|
|
88
|
+
config: {
|
|
89
|
+
host: 'localhost',
|
|
90
|
+
user: 'root',
|
|
91
|
+
password: 'root',
|
|
92
|
+
database: 'entity_storage',
|
|
93
|
+
tableName: 'profiles'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const databaseExists = await connector.databaseExists();
|
|
98
|
+
if (databaseExists) {
|
|
99
|
+
await connector.tableEmpty();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
await connector.tableDrop();
|
|
103
|
+
await connector.stop();
|
|
104
|
+
await connector.close();
|
|
105
|
+
```
|
|
@@ -10,7 +10,7 @@ Class for performing entity storage operations using MySql.
|
|
|
10
10
|
|
|
11
11
|
## Implements
|
|
12
12
|
|
|
13
|
-
- `
|
|
13
|
+
- `IEntityStorageMigrationConnector`\<`T`\>
|
|
14
14
|
|
|
15
15
|
## Constructors
|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ The options for the connector.
|
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
37
|
-
### CLASS\_NAME
|
|
37
|
+
### CLASS\_NAME {#class_name}
|
|
38
38
|
|
|
39
39
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
## Methods
|
|
44
44
|
|
|
45
|
-
### className()
|
|
45
|
+
### className() {#classname}
|
|
46
46
|
|
|
47
47
|
> **className**(): `string`
|
|
48
48
|
|
|
@@ -56,11 +56,29 @@ The class name of the component.
|
|
|
56
56
|
|
|
57
57
|
#### Implementation of
|
|
58
58
|
|
|
59
|
-
`
|
|
59
|
+
`IEntityStorageMigrationConnector.className`
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
###
|
|
63
|
+
### health() {#health}
|
|
64
|
+
|
|
65
|
+
> **health**(): `Promise`\<`IHealth`[]\>
|
|
66
|
+
|
|
67
|
+
Get the health of the component.
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`\<`IHealth`[]\>
|
|
72
|
+
|
|
73
|
+
The health of the component.
|
|
74
|
+
|
|
75
|
+
#### Implementation of
|
|
76
|
+
|
|
77
|
+
`IEntityStorageMigrationConnector.health`
|
|
78
|
+
|
|
79
|
+
***
|
|
80
|
+
|
|
81
|
+
### getSchema() {#getschema}
|
|
64
82
|
|
|
65
83
|
> **getSchema**(): `IEntitySchema`
|
|
66
84
|
|
|
@@ -74,11 +92,11 @@ The schema for the entities.
|
|
|
74
92
|
|
|
75
93
|
#### Implementation of
|
|
76
94
|
|
|
77
|
-
`
|
|
95
|
+
`IEntityStorageMigrationConnector.getSchema`
|
|
78
96
|
|
|
79
97
|
***
|
|
80
98
|
|
|
81
|
-
### bootstrap()
|
|
99
|
+
### bootstrap() {#bootstrap}
|
|
82
100
|
|
|
83
101
|
> **bootstrap**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
84
102
|
|
|
@@ -100,11 +118,37 @@ A promise that resolves to a boolean indicating success.
|
|
|
100
118
|
|
|
101
119
|
#### Implementation of
|
|
102
120
|
|
|
103
|
-
`
|
|
121
|
+
`IEntityStorageMigrationConnector.bootstrap`
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### stop() {#stop}
|
|
126
|
+
|
|
127
|
+
> **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
128
|
+
|
|
129
|
+
The component needs to be stopped when the node is closed.
|
|
130
|
+
|
|
131
|
+
#### Parameters
|
|
132
|
+
|
|
133
|
+
##### nodeLoggingComponentType?
|
|
134
|
+
|
|
135
|
+
`string`
|
|
136
|
+
|
|
137
|
+
The node logging component type.
|
|
138
|
+
|
|
139
|
+
#### Returns
|
|
140
|
+
|
|
141
|
+
`Promise`\<`void`\>
|
|
142
|
+
|
|
143
|
+
Nothing.
|
|
144
|
+
|
|
145
|
+
#### Implementation of
|
|
146
|
+
|
|
147
|
+
`IEntityStorageMigrationConnector.stop`
|
|
104
148
|
|
|
105
149
|
***
|
|
106
150
|
|
|
107
|
-
### get()
|
|
151
|
+
### get() {#get}
|
|
108
152
|
|
|
109
153
|
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
110
154
|
|
|
@@ -138,11 +182,11 @@ The object if it can be found or undefined.
|
|
|
138
182
|
|
|
139
183
|
#### Implementation of
|
|
140
184
|
|
|
141
|
-
`
|
|
185
|
+
`IEntityStorageMigrationConnector.get`
|
|
142
186
|
|
|
143
187
|
***
|
|
144
188
|
|
|
145
|
-
### set()
|
|
189
|
+
### set() {#set}
|
|
146
190
|
|
|
147
191
|
> **set**(`entity`, `conditions?`): `Promise`\<`void`\>
|
|
148
192
|
|
|
@@ -170,11 +214,55 @@ The id of the entity.
|
|
|
170
214
|
|
|
171
215
|
#### Implementation of
|
|
172
216
|
|
|
173
|
-
`
|
|
217
|
+
`IEntityStorageMigrationConnector.set`
|
|
218
|
+
|
|
219
|
+
***
|
|
220
|
+
|
|
221
|
+
### setBatch() {#setbatch}
|
|
222
|
+
|
|
223
|
+
> **setBatch**(`entities`): `Promise`\<`void`\>
|
|
224
|
+
|
|
225
|
+
Set multiple entities in a batch.
|
|
226
|
+
|
|
227
|
+
#### Parameters
|
|
228
|
+
|
|
229
|
+
##### entities
|
|
230
|
+
|
|
231
|
+
`T`[]
|
|
232
|
+
|
|
233
|
+
The entities to set.
|
|
234
|
+
|
|
235
|
+
#### Returns
|
|
236
|
+
|
|
237
|
+
`Promise`\<`void`\>
|
|
238
|
+
|
|
239
|
+
Nothing.
|
|
240
|
+
|
|
241
|
+
#### Implementation of
|
|
242
|
+
|
|
243
|
+
`IEntityStorageMigrationConnector.setBatch`
|
|
174
244
|
|
|
175
245
|
***
|
|
176
246
|
|
|
177
|
-
###
|
|
247
|
+
### empty() {#empty}
|
|
248
|
+
|
|
249
|
+
> **empty**(): `Promise`\<`void`\>
|
|
250
|
+
|
|
251
|
+
Empty the entity storage.
|
|
252
|
+
|
|
253
|
+
#### Returns
|
|
254
|
+
|
|
255
|
+
`Promise`\<`void`\>
|
|
256
|
+
|
|
257
|
+
Nothing.
|
|
258
|
+
|
|
259
|
+
#### Implementation of
|
|
260
|
+
|
|
261
|
+
`IEntityStorageMigrationConnector.empty`
|
|
262
|
+
|
|
263
|
+
***
|
|
264
|
+
|
|
265
|
+
### remove() {#remove}
|
|
178
266
|
|
|
179
267
|
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
180
268
|
|
|
@@ -202,11 +290,63 @@ Nothing.
|
|
|
202
290
|
|
|
203
291
|
#### Implementation of
|
|
204
292
|
|
|
205
|
-
`
|
|
293
|
+
`IEntityStorageMigrationConnector.remove`
|
|
294
|
+
|
|
295
|
+
***
|
|
296
|
+
|
|
297
|
+
### teardown() {#teardown}
|
|
298
|
+
|
|
299
|
+
> **teardown**(`nodeLoggingComponentType?`): `Promise`\<`boolean`\>
|
|
300
|
+
|
|
301
|
+
Teardown the entity storage by dropping the table.
|
|
302
|
+
|
|
303
|
+
#### Parameters
|
|
304
|
+
|
|
305
|
+
##### nodeLoggingComponentType?
|
|
306
|
+
|
|
307
|
+
`string`
|
|
308
|
+
|
|
309
|
+
The node logging component type.
|
|
310
|
+
|
|
311
|
+
#### Returns
|
|
312
|
+
|
|
313
|
+
`Promise`\<`boolean`\>
|
|
314
|
+
|
|
315
|
+
True if the teardown process was successful.
|
|
316
|
+
|
|
317
|
+
#### Implementation of
|
|
318
|
+
|
|
319
|
+
`IEntityStorageMigrationConnector.teardown`
|
|
320
|
+
|
|
321
|
+
***
|
|
322
|
+
|
|
323
|
+
### removeBatch() {#removebatch}
|
|
324
|
+
|
|
325
|
+
> **removeBatch**(`ids`): `Promise`\<`void`\>
|
|
326
|
+
|
|
327
|
+
Remove multiple entities by their primary key IDs.
|
|
328
|
+
|
|
329
|
+
#### Parameters
|
|
330
|
+
|
|
331
|
+
##### ids
|
|
332
|
+
|
|
333
|
+
`string`[]
|
|
334
|
+
|
|
335
|
+
The ids of the entities to remove.
|
|
336
|
+
|
|
337
|
+
#### Returns
|
|
338
|
+
|
|
339
|
+
`Promise`\<`void`\>
|
|
340
|
+
|
|
341
|
+
Nothing.
|
|
342
|
+
|
|
343
|
+
#### Implementation of
|
|
344
|
+
|
|
345
|
+
`IEntityStorageMigrationConnector.removeBatch`
|
|
206
346
|
|
|
207
347
|
***
|
|
208
348
|
|
|
209
|
-
### query()
|
|
349
|
+
### query() {#query}
|
|
210
350
|
|
|
211
351
|
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
212
352
|
|
|
@@ -253,39 +393,175 @@ and a cursor which can be used to request more entities.
|
|
|
253
393
|
|
|
254
394
|
#### Implementation of
|
|
255
395
|
|
|
256
|
-
`
|
|
396
|
+
`IEntityStorageMigrationConnector.query`
|
|
257
397
|
|
|
258
398
|
***
|
|
259
399
|
|
|
260
|
-
###
|
|
400
|
+
### count() {#count}
|
|
401
|
+
|
|
402
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
261
403
|
|
|
262
|
-
|
|
404
|
+
Count all the entities which match the conditions.
|
|
405
|
+
|
|
406
|
+
#### Parameters
|
|
263
407
|
|
|
264
|
-
|
|
408
|
+
##### conditions?
|
|
409
|
+
|
|
410
|
+
`EntityCondition`\<`T`\>
|
|
411
|
+
|
|
412
|
+
The optional conditions to match for the entities.
|
|
265
413
|
|
|
266
414
|
#### Returns
|
|
267
415
|
|
|
268
|
-
`Promise`\<`
|
|
416
|
+
`Promise`\<`number`\>
|
|
269
417
|
|
|
270
|
-
|
|
418
|
+
The total count of entities in the storage.
|
|
419
|
+
|
|
420
|
+
#### Implementation of
|
|
421
|
+
|
|
422
|
+
`IEntityStorageMigrationConnector.count`
|
|
423
|
+
|
|
424
|
+
***
|
|
425
|
+
|
|
426
|
+
### getPartitionContextIds() {#getpartitioncontextids}
|
|
427
|
+
|
|
428
|
+
> **getPartitionContextIds**(): `Promise`\<`IContextIds`[]\>
|
|
429
|
+
|
|
430
|
+
Get all unique partition context ids present in the table.
|
|
431
|
+
|
|
432
|
+
#### Returns
|
|
433
|
+
|
|
434
|
+
`Promise`\<`IContextIds`[]\>
|
|
435
|
+
|
|
436
|
+
An array of context id objects, one per unique partition.
|
|
437
|
+
|
|
438
|
+
#### Implementation of
|
|
439
|
+
|
|
440
|
+
`IEntityStorageMigrationConnector.getPartitionContextIds`
|
|
441
|
+
|
|
442
|
+
***
|
|
443
|
+
|
|
444
|
+
### createTargetConnector() {#createtargetconnector}
|
|
445
|
+
|
|
446
|
+
> **createTargetConnector**\<`U`\>(`newEntitySchema`): `Promise`\<`IEntityStorageConnector`\<`U`\>\>
|
|
447
|
+
|
|
448
|
+
Create the target connector for performing the migration using a temporary table.
|
|
449
|
+
|
|
450
|
+
#### Type Parameters
|
|
451
|
+
|
|
452
|
+
##### U
|
|
453
|
+
|
|
454
|
+
`U`
|
|
455
|
+
|
|
456
|
+
#### Parameters
|
|
457
|
+
|
|
458
|
+
##### newEntitySchema
|
|
459
|
+
|
|
460
|
+
`string`
|
|
461
|
+
|
|
462
|
+
The name of the new entity schema to create the connector for.
|
|
463
|
+
|
|
464
|
+
#### Returns
|
|
465
|
+
|
|
466
|
+
`Promise`\<`IEntityStorageConnector`\<`U`\>\>
|
|
467
|
+
|
|
468
|
+
Connector for performing the migration.
|
|
469
|
+
|
|
470
|
+
#### Implementation of
|
|
471
|
+
|
|
472
|
+
`IEntityStorageMigrationConnector.createTargetConnector`
|
|
473
|
+
|
|
474
|
+
***
|
|
475
|
+
|
|
476
|
+
### finalizeMigration() {#finalizemigration}
|
|
477
|
+
|
|
478
|
+
> **finalizeMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`MySqlEntityStorageConnector`\<`U`\>\>
|
|
479
|
+
|
|
480
|
+
Finalize the migration by dropping the source table and renaming the migration table to the original name.
|
|
481
|
+
|
|
482
|
+
#### Type Parameters
|
|
483
|
+
|
|
484
|
+
##### U
|
|
485
|
+
|
|
486
|
+
`U`
|
|
487
|
+
|
|
488
|
+
#### Parameters
|
|
489
|
+
|
|
490
|
+
##### targetConnector
|
|
491
|
+
|
|
492
|
+
`MySqlEntityStorageConnector`\<`U`\>
|
|
493
|
+
|
|
494
|
+
The connector holding the migrated data in a temporary table.
|
|
495
|
+
|
|
496
|
+
##### options?
|
|
497
|
+
|
|
498
|
+
`IMigrationOptions`\<`T`, `U`\>
|
|
499
|
+
|
|
500
|
+
The options to control how the migration is finalized.
|
|
501
|
+
|
|
502
|
+
##### loggingComponentType?
|
|
503
|
+
|
|
504
|
+
`string`
|
|
505
|
+
|
|
506
|
+
The logging component type to use during finalization.
|
|
507
|
+
|
|
508
|
+
#### Returns
|
|
509
|
+
|
|
510
|
+
`Promise`\<`MySqlEntityStorageConnector`\<`U`\>\>
|
|
511
|
+
|
|
512
|
+
The final connector using the original table name with the new schema.
|
|
513
|
+
|
|
514
|
+
#### Implementation of
|
|
515
|
+
|
|
516
|
+
`IEntityStorageMigrationConnector.finalizeMigration`
|
|
271
517
|
|
|
272
518
|
***
|
|
273
519
|
|
|
274
|
-
###
|
|
520
|
+
### cleanupMigration() {#cleanupmigration}
|
|
521
|
+
|
|
522
|
+
> **cleanupMigration**\<`U`\>(`targetConnector`, `options?`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
523
|
+
|
|
524
|
+
Cleanup a failed or aborted migration by dropping the temporary migration table.
|
|
525
|
+
|
|
526
|
+
#### Type Parameters
|
|
527
|
+
|
|
528
|
+
##### U
|
|
275
529
|
|
|
276
|
-
|
|
530
|
+
`U`
|
|
277
531
|
|
|
278
|
-
|
|
532
|
+
#### Parameters
|
|
533
|
+
|
|
534
|
+
##### targetConnector
|
|
535
|
+
|
|
536
|
+
`IEntityStorageConnector`\<`U`\> \| `undefined`
|
|
537
|
+
|
|
538
|
+
The target connector to cleanup.
|
|
539
|
+
|
|
540
|
+
##### options?
|
|
541
|
+
|
|
542
|
+
`IMigrationOptions`\<`T`, `U`\>
|
|
543
|
+
|
|
544
|
+
The options to control how the migration is cleaned up.
|
|
545
|
+
|
|
546
|
+
##### loggingComponentType?
|
|
547
|
+
|
|
548
|
+
`string`
|
|
549
|
+
|
|
550
|
+
The optional component type to use for logging.
|
|
279
551
|
|
|
280
552
|
#### Returns
|
|
281
553
|
|
|
282
554
|
`Promise`\<`void`\>
|
|
283
555
|
|
|
284
|
-
|
|
556
|
+
A promise that resolves when the cleanup is complete.
|
|
557
|
+
|
|
558
|
+
#### Implementation of
|
|
559
|
+
|
|
560
|
+
`IEntityStorageMigrationConnector.cleanupMigration`
|
|
285
561
|
|
|
286
562
|
***
|
|
287
563
|
|
|
288
|
-
### databaseExists()
|
|
564
|
+
### databaseExists() {#databaseexists}
|
|
289
565
|
|
|
290
566
|
> **databaseExists**(): `Promise`\<`boolean`\>
|
|
291
567
|
|
|
@@ -296,3 +572,18 @@ Check if the database exists.
|
|
|
296
572
|
`Promise`\<`boolean`\>
|
|
297
573
|
|
|
298
574
|
True if the database exists, false otherwise.
|
|
575
|
+
|
|
576
|
+
***
|
|
577
|
+
|
|
578
|
+
### close() {#close}
|
|
579
|
+
|
|
580
|
+
> **close**(): `Promise`\<`void`\>
|
|
581
|
+
|
|
582
|
+
Close the connection pool and release all connections.
|
|
583
|
+
Should be called when the connector is no longer needed.
|
|
584
|
+
|
|
585
|
+
#### Returns
|
|
586
|
+
|
|
587
|
+
`Promise`\<`void`\>
|
|
588
|
+
|
|
589
|
+
Nothing.
|
|
@@ -4,7 +4,7 @@ Configuration for the MySql Entity Storage Connector.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### host
|
|
7
|
+
### host {#host}
|
|
8
8
|
|
|
9
9
|
> **host**: `string`
|
|
10
10
|
|
|
@@ -12,15 +12,15 @@ The host for the MySql instance.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### port?
|
|
15
|
+
### port? {#port}
|
|
16
16
|
|
|
17
|
-
> `optional` **port
|
|
17
|
+
> `optional` **port?**: `number`
|
|
18
18
|
|
|
19
19
|
The port for the MySql instance.
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### user
|
|
23
|
+
### user {#user}
|
|
24
24
|
|
|
25
25
|
> **user**: `string`
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ The user for the MySql instance.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### password
|
|
31
|
+
### password {#password}
|
|
32
32
|
|
|
33
33
|
> **password**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ The password for the MySql instance.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### database
|
|
39
|
+
### database {#database}
|
|
40
40
|
|
|
41
41
|
> **database**: `string`
|
|
42
42
|
|
|
@@ -44,8 +44,88 @@ The name of the database to be used.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### tableName
|
|
47
|
+
### tableName {#tablename}
|
|
48
48
|
|
|
49
49
|
> **tableName**: `string`
|
|
50
50
|
|
|
51
51
|
The name of the table to be used.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### pool? {#pool}
|
|
56
|
+
|
|
57
|
+
> `optional` **pool?**: `object`
|
|
58
|
+
|
|
59
|
+
Optional connection pool configuration.
|
|
60
|
+
|
|
61
|
+
#### connectionLimit?
|
|
62
|
+
|
|
63
|
+
> `optional` **connectionLimit?**: `number`
|
|
64
|
+
|
|
65
|
+
Maximum number of connections in pool.
|
|
66
|
+
|
|
67
|
+
##### Default
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
10
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### maxIdle?
|
|
74
|
+
|
|
75
|
+
> `optional` **maxIdle?**: `number`
|
|
76
|
+
|
|
77
|
+
Maximum number of idle connections.
|
|
78
|
+
|
|
79
|
+
##### Default
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
10
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### idleTimeout?
|
|
86
|
+
|
|
87
|
+
> `optional` **idleTimeout?**: `number`
|
|
88
|
+
|
|
89
|
+
Time in ms before removing idle connection.
|
|
90
|
+
|
|
91
|
+
##### Default
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
60000 (1 minute)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### enableKeepAlive?
|
|
98
|
+
|
|
99
|
+
> `optional` **enableKeepAlive?**: `boolean`
|
|
100
|
+
|
|
101
|
+
Enable TCP keep-alive.
|
|
102
|
+
|
|
103
|
+
##### Default
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
true
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### waitForConnections?
|
|
110
|
+
|
|
111
|
+
> `optional` **waitForConnections?**: `boolean`
|
|
112
|
+
|
|
113
|
+
Wait for available connection when pool is full.
|
|
114
|
+
|
|
115
|
+
##### Default
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
true
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### queueLimit?
|
|
122
|
+
|
|
123
|
+
> `optional` **queueLimit?**: `number`
|
|
124
|
+
|
|
125
|
+
Maximum queued requests (0 = unlimited).
|
|
126
|
+
|
|
127
|
+
##### Default
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
0
|
|
131
|
+
```
|
|
@@ -4,7 +4,7 @@ The options for the MySql entity storage connector constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### entitySchema
|
|
7
|
+
### entitySchema {#entityschema}
|
|
8
8
|
|
|
9
9
|
> **entitySchema**: `string`
|
|
10
10
|
|
|
@@ -12,17 +12,17 @@ The schema for the entity.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### partitionContextIds?
|
|
15
|
+
### partitionContextIds? {#partitioncontextids}
|
|
16
16
|
|
|
17
|
-
> `optional` **partitionContextIds
|
|
17
|
+
> `optional` **partitionContextIds?**: `string`[]
|
|
18
18
|
|
|
19
19
|
The keys to use from the context ids to create partitions.
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### loggingComponentType?
|
|
23
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
24
24
|
|
|
25
|
-
> `optional` **loggingComponentType
|
|
25
|
+
> `optional` **loggingComponentType?**: `string`
|
|
26
26
|
|
|
27
27
|
The type of logging component to use.
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ logging
|
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
37
|
-
### config
|
|
37
|
+
### config {#config}
|
|
38
38
|
|
|
39
39
|
> **config**: [`IMySqlEntityStorageConnectorConfig`](IMySqlEntityStorageConnectorConfig.md)
|
|
40
40
|
|