What's the recommended way to do a basic filter by a boolean column's value?

I can't figure out how to use a non-filter expression for filtering. e.g., I would expect db.select().from(appointment).where(appointment.canceled) to generate the equivalent sql select * from appointment where appointment.canceled, which works exactly how I expect. .where(() => appointment.canceled) or .where((a) => a.canceled) don't work either. I can use
.where(sql`${appointment.canceled}`)
.where(sql`${appointment.canceled}`)
but surely there must be a simpler way? I can provide this column as an argument to a filter, so why can't I use this column itself as a filter?
2 Replies
titongo
titongo2mo ago
Is it not possible to use .where(eq(appointment.canceled, true))
francis
francis2mo ago
I guess I can. I was expecting to able to use the same kind of shorthand that I do in sql, where you use the boolean value as the entire condition expression
Want results from more Discord servers?
Add your server