Skip to content

is it possible to use operators with the entity query? #385

Answered by vincentlauvlwj
sombriks asked this question in Q&A
Discussion options

You must be logged in to vote

It's a problem of Kotlin compiler, note the position of line breaking.

Fail:

val rows = Db.database.sequenceOf(Beers).filter {
    (it.descriptionBeer like "%$search%")
    or (it.titleBeer like "%$search%")
}

Works:

val rows = Db.database.sequenceOf(Beers).filter {
    (it.descriptionBeer like "%$search%") or
    (it.titleBeer like "%$search%")
}

Also works:

val rows = Db.database.sequenceOf(Beers).filter {
    (it.descriptionBeer like "%$search%")
    .or(it.titleBeer like "%$search%")
}

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sombriks
Comment options

Answer selected by sombriks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants