|previous : next|
Kotlin BOOLEAN value expressions
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
A BOOLEAN column (
Field<Boolean>) and a conditional expression (
Condition) are not really too different, especially when the dialect supports standard SQL
In jOOQ, the two things can often be used exchangeably, but there are some exceptions, mainly when BOOLEAN operators should be used with (
At least the left side of the expression has to be wrapped with DSL.condition(Field), which is cumbersome.
Using the kotlin extensions module, these operators are also made available on
package org.jooq.kotlin fun Field<Boolean>.and(other: Condition): Condition = condition(this).and(other) fun Field<Boolean>.or(other: Condition): Condition = condition(this).or(other) fun Field<Boolean>.not(): Condition = condition(this).not() // [... and more]
This allows for the leaner version below:
Do you have any feedback about this page? We'd love to hear it!