drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Optional joins
Open
enhancement
qb/crud
qb/joins
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
Similar to the `where` function, I would like to be able to join optionally, based on a condition.
```ts
db
.select()
.from(table)
.where(condition ? eq(...) : undefined)
```
Proposed api (but of course it can be anything else that makes sense and allows for optional joining):
```ts
db
.select()
.from(table)
.leftJoin(anotherTable, condition ? eq(...) : undefined)
```
Contributor guide
Assessment
This issue has not been assessed yet.