Is there a way to modify the select() on an existing query ?
Let's say I have this query that I pass to a function
in my function, I'd like to clone the query, and modify its
select()
clause to something like this:
Is this possible?
My current workaround is to inspect the config
property on my query to create a new one, but I know that I shouldn't mess with internals:
4 Replies
I feel like the answer to my question is no, since the initial
.select().from()
is crucial for Drizzle typing..
In that case, would changing config
visibility something that could be considered?
My use case is for a data provider function, where I pass a query, and it gives me back paginated results (adding limit().offset()) and and the global pagination infoYes, exposing the config might be a good idea
Will add to backlog
I also needed the
SelectResult
type, but it seems to only be defined in generated files under nodemodules/drizzle-orm/ :/
generating an additional generated.ts
file re-exporting from the generated files would also help I guess
And I also needed to tap into `query..selectedFields` 😁