drizzle-team / drizzle-team/drizzle-orm-docs
Inform the user about the fact that query builders implement `Promise`
- Dominant language
- MDX
- Stars
- 241
- Forks
- 401
- Avg merge
- 5h 44m
- Merged PRs (30d)
- 1
Description
I had opened [a discussion](https://github.com/drizzle-team/drizzle-orm/discussions/1637) in the ORM repo about adding a feature that transforms the query's result after it's been obtained from the driver, but I had forgotten that this is already possible using the `then` method on the query builder, since it just extends `Promise`.
I feel like the fact that the query builders extend `Promise` is pretty easy to miss, and could be something worth noting in the documentation.
A frequently asked feature in the core API is some `findFirst` and `findFirstOrThrow` equivalent, and the documentation can provide an example as to how a developer than implement such functionality:
```ts
const user = db.select().from(users).limit(1).then((result) => result[0]);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.