BluePin
BluePin
TtRPC
Created by BluePin on 3/22/2024 in #❓-help
“Integrating Drizzle Prepared Statements with tRPC Context”
Another thing is, if you put all the prepared statements in the context, does it have a memory limit on how long it can stay within the context? Is it bad to put too many things in context?
4 replies
TtRPC
Created by BluePin on 3/22/2024 in #❓-help
“Integrating Drizzle Prepared Statements with tRPC Context”
4 replies
TtRPC
Created by BluePin on 3/22/2024 in #❓-help
“Integrating Drizzle Prepared Statements with tRPC Context”
I thought about using this to make my queries super fast using the least amount of CPU and RAM possible. However, I found a problem. Since the prepared queries are within a variable and they usually use the db variable, I can’t use it unless I put ALL the variables with the prepared queries, which can easily be 10,000 different queries for various contexts and needs.
import * as usersPrepared from ".db/PreparedStatements/users"
import * as accountsPrepared from ".db/PreparedStatements/acconts"
export const createTRPCContext = async (opts: { headers: Headers }) => {
return {
db,
...usersPrepared,
...accountsPrepared
...opts,
};
};
import * as usersPrepared from ".db/PreparedStatements/users"
import * as accountsPrepared from ".db/PreparedStatements/acconts"
export const createTRPCContext = async (opts: { headers: Headers }) => {
return {
db,
...usersPrepared,
...accountsPrepared
...opts,
};
};
How can I solve this? Is there a way to integrate Drizzle’s Prepared Statements with the tRPC context without having to put all the prepared queries in the context? Any guidance or suggestions would be greatly appreciated. Thank you.
4 replies