drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

Adding to query

Open quinnvaughn opened this issue 2 years ago • 1 comments

Is there any way to optionally expand onto a query?

I have a GraphQL server and in the query I have optional args I need to check for, and if so that expands what the query is looking for, ie is there text? Query for the description containing text. Is there a cursor? Decode the cursor and check it against the created_at. I assumed this is what subqueries are for, but I'm not totally sure, and I'm not sure how to type it if so, as well as I'm not sure how to conditionally pass in a subquery to a with, as it might not exist, and I'm not sure what the negative case return is supposed to be.

quinnvaughn avatar Mar 06 '23 00:03 quinnvaughn

Could you provide some examples of the SQL queries you are trying to build? I'm not sure I understand what exactly are you trying to achieve. Also, I'm curious about the "conditional with" case you're describing. Could you elaborate on your use case? In general, using ternary operator in .with() should be enough for that, but might depend on your specific case.

dankochetov avatar Mar 06 '23 06:03 dankochetov