drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Optional joins

Open
#1,533 2 comments 10 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.