Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inform the user about the fact that query builders implement Promise #183

Open
L-Mario564 opened this issue Dec 13, 2023 · 0 comments
Open

Comments

@L-Mario564
Copy link

I had opened a discussion 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:

const user = db.select().from(users).limit(1).then((result) => result[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant