-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
I would like to be able to use query API for subqueries
const sq = db.select().from(users).as('sq');
const result = await db.query.fromSub(sq).findMany({
where: {
id: 42
}
});It seems that this should be possible.
The idea is simple: just to be able to use query findMany, findFirst APIs for arbitrary sub queries.
This also can be implemented as a helper function I think:
something like:
function findMany(args, subQuery) {
// obviously this would be much more complicated to handle different edge cases
return db.select().from(subQuery).where(eq(args.where.id, subQuery.id))
}Would be nice to have it included in orm itself but also this could be implemented in user land using helper function and regular builder api
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request