drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Add query pluck to return only single column value

Open
#1,296 0 comments 2 reactions 0 assignees 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

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

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.