Replies: 3 comments
-
My bad, ready the code, it's already there. Always one step ahead ! (or I am one step behind :-) ) |
Beta Was this translation helpful? Give feedback.
-
Actually, there is indeed a callback to obtain the client. But as the query itself should be run inside the transaction function, I am not sure if it fits the bill. To work, the dizzle-plugin client callback should rather pass on another callback (the query callback) to be called with the client as parameters, inside the transaction block. |
Beta Was this translation helpful? Give feedback.
-
A, but actually we might be able to use the proxy api to return a modified client : drizzle-team/drizzle-orm#2450 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
With the recent support of RLS in drizzle schéma, but even before that, users may want to be able to wrap queries made by the plugin in some transactions where data used by RLS, like role or user id, is injected.
Maybe there could be an option to pass a callback as the drizzle client to the global config, passing on the graphql context, so that one can initiate a transaction there, executing the query on the handler returned by drizzle inside the transaction initializer? Would that work with the client caching mechanism présent in the plugin ?
Beta Was this translation helpful? Give feedback.
All reactions