Skip to content

Commit 2bbff97

Browse files
committed
Documentation for the new where clause DSL
1 parent 0263227 commit 2bbff97

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ For example, a typical search can be coded with a query like this (the following
2222
fun search(id: String?, firstName: String?, lastName: String?) =
2323
select(Customer.id, Customer.firstName, Customer.lastName) {
2424
from(Customer)
25-
where(Customer.active, isEqualTo(true))
26-
and(Customer.id, isEqualToWhenPresent(id).map{ it?.padStart(5, '0') })
27-
and(Customer.firstName, isLikeCaseInsensitiveWhenPresent(firstName)
28-
.map{ "%" + it.trim() + "%" })
29-
and(Customer.lastName, isLikeCaseInsensitiveWhenPresent(lastName)
30-
.map{ "%" + it.trim() + "%" })
25+
where { Customer.active.isTrue() }
26+
and { Customer.id (isEqualToWhenPresent(id).map{ it?.padStart(5, '0') }) }
27+
and { Customer.firstName (isLikeCaseInsensitiveWhenPresent(firstName)
28+
.map{ "%" + it.trim() + "%" }) }
29+
and { Customer.lastName (isLikeCaseInsensitiveWhenPresent(lastName)
30+
.map{ "%" + it.trim() + "%" }) }
3131
orderBy(Customer.lastName, Customer.firstName)
3232
limit(500)
3333
}

0 commit comments

Comments
 (0)