Using `nil` in composable where clause?

How can I use nil in a composable query? Is there a way to use is_nil/1 here?

Model
|> where(col_a: 1, col_b: nil)

Also, this compiles if the do the following, but doesn’t return the expected results

Model
|> where(col_a: 1, col_b: ^nil)
Model
|> where([m], is_nil(m.col_b))

even better

Model
|> from(as: :model)
|> where([model: m], is_nil(m.col_b))
1 Like