Skip to content

Commit b313dec

Browse files
committed
Add support for MySQL based transactions to TableRepository
1 parent ff631ce commit b313dec

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strontium",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "Strontium is a TypeScript toolkit for High Performance API servers built for Production not Projects.",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",

src/query/drivers/sql/TableRepository.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { pgQueryPostProcessor } from "../pg/PGQueryPostProcessor"
22
import { Repository } from "../../abstract/Repository"
3-
import { MySQLStore, PGStore, SQLStore } from "../../../datastore"
3+
import {
4+
MySQLStore,
5+
MySQLTransaction,
6+
PGStore,
7+
SQLStore,
8+
} from "../../../datastore"
49
import { injectable } from "inversify"
510
import { isUndefined, omitBy } from "lodash"
611

@@ -46,7 +51,10 @@ export abstract class TableRepository<
4651
// Filter the payload for any undefined keys
4752
let filteredPayload = (omitBy(payload, isUndefined) as unknown) as T
4853

49-
if (connection instanceof MySQLStore) {
54+
if (
55+
connection instanceof MySQLStore ||
56+
connection instanceof MySQLTransaction
57+
) {
5058
let insertQuery = `
5159
INSERT INTO
5260
??

0 commit comments

Comments
 (0)