Is there any benefit to putting the db connection in the context versus having it as an global var?
Can I do this?
or in this way i have a benefit?
or in this way i have a benefit?
Solution
I've wondered why I should use the tRPC context instead of just importing my database singleton from a module. Is there any benefit to it?
Because of TS performance issues, I'm creating multiple functions for bigger procedures. And passing the db connection around may be an unnecessary overhead.
Because of TS performance issues, I'm creating multiple functions for bigger procedures. And passing the db connection around may be an unnecessary overhead.