Does Drizzle-Orm Expose Wrapper Types?
So I want to write a wrapper around drizzle-orm where I can pass in things like a
where
filter or order
filter so in case I ever change to a different ORM I can do so. Does drizzle-orm expose the types for each of these methods?
Or is there some example of folks writing a general wrapper around it?
For example, type-orm
exposes a lot of input option types like below:
3 Replies
The input for findMany and findFirst is very dependent on your schema, tables and relations. We were discussing how to provide an easy to use helper type but there are other priorities and the results we were getting weren't that good
Take a look at this discussion where I offered some workarounds
GitHub
Relations input · drizzle-team drizzle-orm · Discussion #1483
I have a schema that looks like somewhat like this: export const employeesSchema = pgTable('employees', { firstName: varchar('first_name', { length: 256 }), lastName: varchar('l...
Thank you. And if I just want to provide some additional options like filtering, orderBy, where options around my wrapper get method, are there any examples for this by any chance?
async getEmailById(data: string, options: any): Promise<void> {
await client.select().from(emails).where(eq(emails.id, data));
}
I got something like the code below from AI, but wondering how to define the difference argument types - Predicate, Order, SelectedFields