Dynamic where clause

Hello, I'm attempting to following the documentation here https://orm.drizzle.team/docs/dynamic-query-building to build a dynamic query but I'm getting the following error: Generic type 'PgSelect<TTableName, TSelection, TSelectMode, TNullabilityMap>' requires between 3 and 4 type arguments. My code is:
private filterByProgramLevel<T extends PgSelect>(qb: T, programLevel: ProgramLevel): T {
return qb.where(and(isNull(lessons.deletedAt), eq(lessons.programLevel, programLevel)))
}
private filterByProgramLevel<T extends PgSelect>(qb: T, programLevel: ProgramLevel): T {
return qb.where(and(isNull(lessons.deletedAt), eq(lessons.programLevel, programLevel)))
}
Any suggestions? Or, are there any other ways of making dynamic WHERE clauses? This seems like a bit of a hassle to do a common thing so I'm thinking I don't really need to do it this way 🤷‍♂️
Dynamic query building - Drizzle ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
No description
1 Reply
Vovochka
Vovochka12mo ago
npm install drizzle-orm@latest
Want results from more Discord servers?
Add your server