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
SELECT*FROM"user"WHERE ("firstName"='Timber'AND"lastName"='Saw') OR ("firstName"='Stan'AND"lastName"='Lee')
@@ -66,7 +66,7 @@ SELECT * FROM "user" WHERE ("firstName" = 'Timber' AND "lastName" = 'Saw') OR ("
66
66
*`order` - selection order.
67
67
68
68
```typescript
69
-
userRepository.find({
69
+
userRepository.find({
70
70
order: {
71
71
name: "ASC",
72
72
id: "DESC"
@@ -79,28 +79,28 @@ userRepository.find({
79
79
*`skip` - offset (paginated) from where entities should be taken.
80
80
81
81
```typescript
82
-
userRepository.find({
82
+
userRepository.find({
83
83
skip: 5
84
84
});
85
85
```
86
86
87
87
*`take` - limit (paginated) - max number of entities that should be taken.
88
88
89
89
```typescript
90
-
userRepository.find({
90
+
userRepository.find({
91
91
take: 10
92
92
});
93
93
```
94
94
95
95
** If you are using typeorm with MSSQL, and want to use `take` or `limit`, you need to use order as well or you will receive the following error: `'Invalid usage of the option NEXT in the FETCH statement.'`
`pessimistic_partial_write` and `pessimistic_write_or_fail` are supported only on Postgres and are equivalents of `SELECT .. FOR UPDATE SKIP LOCKED` and `SELECT .. FOR UPDATE NOWAIT`, accordingly.
setLock(lockMode: "optimistic"|"pessimistic_read"|"pessimistic_write"|"dirty_read"|"for_no_key_update",lockVersion?: number|Date): this {
975
+
setLock(lockMode: "optimistic"|"pessimistic_read"|"pessimistic_write"|"dirty_read"|"pessimistic_partial_write"|"pessimistic_write_or_fail"|"for_no_key_update",lockVersion?: number|Date): this {
976
976
this.expressionMap.lockMode=lockMode;
977
977
this.expressionMap.lockVersion=lockVersion;
978
978
returnthis;
@@ -1672,6 +1672,20 @@ export class SelectQueryBuilder<Entity> extends QueryBuilder<Entity> implements
1672
1672
}else{
1673
1673
thrownewLockNotSupportedOnGivenDriverError();
1674
1674
}
1675
+
case"pessimistic_partial_write":
1676
+
if(driverinstanceofPostgresDriver){
1677
+
return" FOR UPDATE SKIP LOCKED";
1678
+
1679
+
}else{
1680
+
thrownewLockNotSupportedOnGivenDriverError();
1681
+
}
1682
+
case"pessimistic_write_or_fail":
1683
+
if(driverinstanceofPostgresDriver){
1684
+
return" FOR UPDATE NOWAIT";
1685
+
}else{
1686
+
thrownewLockNotSupportedOnGivenDriverError();
1687
+
}
1688
+
1675
1689
case"for_no_key_update":
1676
1690
if(driverinstanceofPostgresDriver){
1677
1691
return" FOR NO KEY UPDATE";
@@ -1812,7 +1826,7 @@ export class SelectQueryBuilder<Entity> extends QueryBuilder<Entity> implements
1812
1826
if(!this.expressionMap.mainAlias)
1813
1827
thrownewError(`Alias is not set. Use "from" method to set an alias.`);
0 commit comments