You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,30 @@ SSL: {
26
26
}
27
27
```
28
28
29
-
#Data Typing Options
29
+
## Data Typing Options
30
30
31
31
This connector gives you a few options for configuring how data is returned from the connector. 'typeCast' defaults to true, and converts
32
32
data from the database to its javascript equivalent. For example, it will convert DATETIME SQL objects to a DATE javascript type.
33
33
You can also set 'dateStrings' which defaults to false. If you set it to true it will override typeCast and force date returns to be a string instead of a DATE type.
34
+
35
+
## Working within a transaction
36
+
As of version 0.1.0 you can utilize sql transactions. Simply call the transactionConnection method to get a transaction connection and then begin the transaction.
37
+
Then, write as many queries as you want, and when you are done, you can commit the transaction and all of your queries will be saved to the database or you can roll back the transaction and nothing done while inside that transaction will be saved. Some pseudo-code for how you might do that is below:
38
+
```
39
+
someMethod = async () => {
40
+
const pool = await dataSource.connect(DATABASE_POOL);
0 commit comments