is it possible to use operators with the entity query? #385
-
i was looking for some idiom like this: val employees = database.sequenceOf(Employees).filter { (it.name like "%$search%") or (it.jobTitle like "%$search%") }.toList() I saw https://www.ktorm.org/en/entity-finding.html#Get-Entities-by-Query-DSL, just looking for something different |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Yes, of course. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/sombriks/rosetta-beer-store/pull/1/files rn it says it's invalid, how can i proceed? |
Beta Was this translation helpful? Give feedback.
-
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%")
} |
Beta Was this translation helpful? Give feedback.
It's a problem of Kotlin compiler, note the position of line breaking.
Fail:
Works:
Also works: