drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Add `getSubqueryFields` helper to goodies

Open
#1,459 3 comments 17 reactions 1 assignee Claimed by @Angelelz View on GitHub
enhancement qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

The `getTableColumns` helper is really useful, but an equivalent lacks for subqueries. This can easily be implemented in userland, although it feels like the kind of helper that should come with `drizzle-orm`.

Crude implementation:

```ts
export function getSubqueryFields(
query: WithSubqueryWithSelection | SubqueryWithSelection
): (typeof query)['_']['selectedFields'] {
return query[SubqueryConfig as unknown as string].selection;
}
```

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.