drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Add query pluck to return only single column value
Open
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
Sometimes it is useful to have flat array of ids or any values:
```js
DB.select(posts.id).from(posts).then(r => r.map(v => v.id))
```
We can turn it into this:
```js
DB.pluck(posts.id).from(posts)
```
Plucking is available in many other database interfaces like ActiveRecord and Eloquent. They are especially handy when additional processing of the results is necessary or when working with multiple result sets.
Contributor guide
Assessment
This issue has not been assessed yet.