Hello!
There is a question from my side that I would like to ask.
In our team, we use Jooq with Kotlin. And imagine that we have a data class called SomeFilter.
SomeFilter(val firstName: String?, val lastName: String?, val age: Int?)
As you can see, this filter includes optional fields. While creating the query, I perform the following steps.
dsl.selectFrom(TABLE)
.where(firstName?.let{ FIRST_NAME.eq(it) })
.and(lastName?.let{ LAST_NAME.eq(it) })
.and(age?.let{ AGE.eq(it) })
And this kind of query works perfectly fine, in case a field is null, then Jooq ignores that null part.
But, the question is, is this the way of handling such an optional filter while writing Jooq queries?
Or is there a better way of doing it?
Thanks,
Ufuk