How to type the Postgres transaction object?
I'm generating a transaction object using the following setup
What I'm trying to achieve is to be able to type the tx object when I pass it as a function but I'm not sure what the type should be.
6 Replies
Hello, @Jude! Try this
I do this:
Thanks guys.
Hey @solo is schema here an instance of the pgTable schema or something else?
Hey @francis could you let me know where the drizzle object comes from? How should one import that?
for the database driver I use it's
import { drizzle } from "drizzle-orm/postgres-js";
but the point is to get the type of the client that you would call .transaction
on. The Parameters....
etc type is to extract the type of the transaction object from that method.@Jude it's import of all tables from your
schema.ts
file
Thanks guys, that really worked!!