Skip to content

Conditions

Examples of conditions that can be used in queries:

FunctionExample
Is nullUserTable.name.isNull()
Is not nullUserTable.name.isNotNull()
EqualsUserTable.id eq 123456
Not equalsUserTable.name notEq "Panda
Left greater than rightUserTable.id greaterThan 1000
Left greater or equals rightUserTable.id greaterThanOrEq 1000
Left less than rightUserTable.id lessThan 1000
Left less or equals rightUserTable.id lessThanOrEq 1000
LikeUserTable.name like "G%O%N%E"
Not likeUserTable.name notLike "G%O%N%E"
BetweenUserTable.createdAt between (now().minusMinutes(1) and now().plusMinutes(1))
Not BetweenUserTable.createdAt notBetween (now().minusMinutes(1) and now().plusMinutes(1))
InUserTable.id within setOf(1, 2, 3)
Not InUserTable.id notWithin setOf(1, 2, 3)

If you want to combine multiple conditions, you can use the and and or functions:

kotlin
where {
    or(
        and(
            UserTable.id notEq 1,
            UserTable.name like "A%",
        ),
        and(
            UserTable.id notEq 2,
            UserTable.name like "B%",
        )
    )
}