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
+43-4Lines changed: 43 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,8 @@ The ultimate Object Relational Mapper for Node.js and Typescript, offering seaml
29
29
✅ MySQL
30
30
✅ Oracle
31
31
✅ SAP ASE
32
-
✅ SQLite
32
+
✅ SQLite
33
+
✅ Cloudflare D1
33
34
34
35
35
36
This is the _Modern Typescript Documentation_. Are you looking for the [_Classic Documentation_](https://github.com/alfateam/orange-orm/blob/master/docs/docs.md) ?
@@ -468,7 +502,7 @@ Currently, there are three concurrency strategies:
468
502
- <strong>`overwrite`</strong> Overwrites the property, regardless of changes by others.
469
503
- <strong>`skipOnConflict`</strong> Silently avoids updating the property if another user has modified it in the interim.
470
504
471
-
The <strong>concurrency</strong> option can be set either for the whole table or individually for each column. In the example below, we are using the <strong>overwrite</strong> strategy on the <strong>vendor</strong> table except on the column <strong>balance</strong> which uses the <strong>skipOnConflict</strong> strategy. In this particular case, a row with <strong>id: 1</strong> already exists, the <strong>name</strong> and <strong>isActive</strong> fields will be overwritten, but the balance will remain the same as in the original record, demonstrating the effectiveness of combining multiple <strong>concurrency</strong> strategies.
505
+
The <strong>concurrency</strong> option can be set either for the whole table or individually for each column. In the example below, we've set the concurrency strategy on <strong>vendor</strong> table to <strong>overwrite</strong> except for the column <strong>balance</strong> which uses the <strong>skipOnConflict</strong> strategy. In this particular case, a row with <strong>id: 1</strong> already exists, the <strong>name</strong> and <strong>isActive</strong> fields will be overwritten, but the balance will remain the same as in the original record, demonstrating the effectiveness of combining multiple <strong>concurrency</strong> strategies.
472
506
473
507
```javascript
474
508
importmapfrom'./map';
@@ -885,7 +919,7 @@ Currently, there are three concurrency strategies:
885
919
- <strong>`overwrite`</strong> Overwrites the property, regardless of changes by others.
886
920
- <strong>`skipOnConflict`</strong> Silently avoids updating the property if another user has modified it in the interim.
887
921
888
-
The <strong>concurrency</strong> option can be set either for the whole table or individually for each column. In the example below, we are using the <strong>overwrite</strong> strategy on the table <strong>vendor</strong> except on the column <strong>balance</strong> which uses the <strong>skipOnConflict</strong> strategy. In this particular case, a row with <strong>id: 1</strong> already exists, the <strong>name</strong> and <strong>isActive</strong> fields will be overwritten, but the balance will remain the same as in the original record, demonstrating the effectiveness of combining multiple <strong>concurrency</strong> strategies.
922
+
The <strong>concurrency</strong> option can be set either for the whole table or individually for each column. In the example below, we've set the concurrency strategy on <strong>vendor</strong> table to <strong>overwrite</strong> except for the column <strong>balance</strong> which uses the <strong>skipOnConflict</strong> strategy. In this particular case, a row with <strong>id: 1</strong> already exists, the <strong>name</strong> and <strong>isActive</strong> fields will be overwritten, but the balance will remain the same as in the original record, demonstrating the effectiveness of combining multiple <strong>concurrency</strong> strategies.
889
923
890
924
```javascript
891
925
importmapfrom'./map';
@@ -1580,6 +1614,8 @@ async function getRows() {
1580
1614
Within the transaction, a customer is retrieved and its balance updated using the tx object to ensure operations are transactional.
1581
1615
An error is deliberately thrown to demonstrate a rollback, ensuring all previous changes within the transaction are reverted.
1582
1616
Always use the provided tx object for operations within the transaction to maintain data integrity.</p>
1617
+
<p>(NOTE: Transactions are not supported for Cloudflare D1)</p>
<p>You enable logging by listening to the query event on the `orange` object. During this event, both the SQL statement and any associated parameters are logged.</p>
2006
+
<p>You enable logging by listening to the query event on the `orange` object. During this event, both the SQL statement and any associated parameters are logged. The logged output reveals the sequence of SQL commands executed, offering developers a transparent view into database operations, which aids in debugging and ensures data integrity.</p>
1970
2007
1971
2008
```javascript
1972
2009
importorangefrom'orange-orm';
@@ -1996,8 +2033,10 @@ async function updateRow() {
1996
2033
1997
2034
output:
1998
2035
```bash
2036
+
BEGIN
1999
2037
select _order.id as s_order0,_order.orderDate as s_order1,_order.customerId as s_order2 from _order _order where _order.id=2 order by _order.id limit 1
2000
2038
select orderLine.id as sorderLine0,orderLine.orderId as sorderLine1,orderLine.product as sorderLine2,orderLine.amount as sorderLine3 from orderLine orderLine where orderLine.orderIdin (2) order by orderLine.id
2039
+
COMMIT
2001
2040
BEGIN
2002
2041
select _order.id as s_order0,_order.orderDate as s_order1,_order.customerId as s_order2 from _order _order where _order.id=2 order by _order.id limit 1
thrownewError(`The field ${change.path.replace('/','')} was changed by another user. Expected ${inspect(fromCompareObject(expectedOldValue),false,10)}, but was ${inspect(fromCompareObject(oldValue),false,10)}.`);
49
+
thrownewError(`The field ${change.path.replace('/','')} was changed by another user. Expected ${inspect(fromCompareObject(expectedOldValue))}, but was ${inspect(fromCompareObject(oldValue))}.`);
52
50
}
53
51
}
54
52
returntrue;
@@ -99,7 +97,16 @@ function assertDatesEqual(date1, date2) {
0 commit comments