wrapping of queries
I want to wrap all/some of my queries to instrument them for observability
The types are wrong. What would be the way to do this correctly?
The types are wrong. What would be the way to do this correctly?
import { type SQLWrapper } from "drizzle-orm";
type DrizzleQuery<T> = SQLWrapper & Promise<T>;
export async function instrument<T>(query: DrizzleQuery<T>): Promise<T> {
logger.debug(`QUERY: `, query.toSQL())
return await query;
}