Skip to content

Commit 5253c8f

Browse files
docs: add examples in soft delete doc (typeorm#9402)
1 parent c053257 commit 5253c8f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/delete-query-builder.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Examples:
1212

1313
```typescript
1414
await myDataSource
15-
.createQueryBuilder()
15+
.createQueryBuilder('users')
1616
.delete()
1717
.from(User)
1818
.where("id = :id", { id: 1 })
@@ -29,10 +29,30 @@ Applying Soft Delete to QueryBuilder
2929
await dataSource.getRepository(Entity).createQueryBuilder().softDelete()
3030
```
3131

32+
Examples:
33+
34+
```typescript
35+
await myDataSource
36+
.createQueryBuilder('users')
37+
.softDelete()
38+
.where("id = :id", { id: 1 })
39+
.execute();
40+
```
41+
3242
### `Restore-Soft-Delete`
3343

3444
Alternatively, You can recover the soft deleted rows by using the `restore()` method:
3545

3646
```typescript
3747
await dataSource.getRepository(Entity).createQueryBuilder().restore()
3848
```
49+
50+
Examples:
51+
52+
```typescript
53+
await myDataSource
54+
.createQueryBuilder('users')
55+
.restore()
56+
.where("id = :id", { id: 1 })
57+
.execute();
58+
```

0 commit comments

Comments
 (0)