@dbos-inc/typeorm-datasource 3.4.9-preview → 3.4.11-preview
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/package.json +1 -1
- package/tests/datasource.test.ts +2 -2
package/package.json
CHANGED
package/tests/datasource.test.ts
CHANGED
|
@@ -16,7 +16,7 @@ class Greeting {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const config = { user: 'postgres', database: 'typeorm_ds_test_datasource' };
|
|
19
|
-
const dataSource =
|
|
19
|
+
const dataSource = TypeOrmDataSource.createFromConfig('app-db', config, [Greeting]);
|
|
20
20
|
|
|
21
21
|
interface transaction_completion {
|
|
22
22
|
workflow_id: string;
|
|
@@ -347,7 +347,7 @@ async function createDatabases(createTxCompletions: boolean) {
|
|
|
347
347
|
|
|
348
348
|
async function insertFunction(user: string) {
|
|
349
349
|
type Result = Array<{ greet_count: number }>;
|
|
350
|
-
const rows = await
|
|
350
|
+
const rows = await dataSource.entityManager.sql<Result>`
|
|
351
351
|
INSERT INTO greetings(name, greet_count) VALUES(${user}, 1)
|
|
352
352
|
ON CONFLICT(name) DO UPDATE SET greet_count = greetings.greet_count + 1
|
|
353
353
|
RETURNING greet_count`;
|