.$inferSelect for relations
Hello there, is there a convenient way to get the list of relations of a specific table ? Either directly or at the type level.
Basically getting what the with argument accept in the rqb.
Cheers o/
3 Replies
oh I see there's a PR https://github.com/drizzle-team/drizzle-orm/pull/1670
GitHub
Feat: infer type helpers for relations by Angelelz · Pull Request #...
close #695
Added InferManyRelationalResult and InferFirstRelationalResult generic types to infer the resulting object shape.
Added db.query.<tableName>.$inferFindManyArgs and db.query.<ta...
Yeah, but check out this discussion for a workaround https://github.com/drizzle-team/drizzle-orm/discussions/1483
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...
Damn I should have checked this thread, I went this route already
this is actually not bad in my usecase (making a graphql api) because I don't want to expose everything