Skip to content

Commit b602703

Browse files
committed
update file for post 1.5 klite
1 parent 24bd709 commit b602703

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

jdbc/TEX.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,35 @@ ResultSet.getId()
4949
It's good to keep domain classes close to DB tables, with same column names
5050

5151
```kotlin
52-
val user = db.query("users", mapOf("email" to "hello@example.com")) { fromValues<User>() }.first()
52+
val user = db.select("users", "email" to "hello@example.com") { create<User>() }.first()
5353
```
5454

5555

5656
### What if I need to change how some fields are read?
5757

5858
```kotlin
59-
val user = db.query("users", mapOf("email" to "hello@example.com")) { fromValues(User::role to Role.BACKOFFICE) }
59+
val user = db.select("users", "email" to "hello@example.com") { create(User::role to Role.BACKOFFICE) }
6060
```
6161

6262
### Why not type-safe where?
6363

6464
```kotlin
65-
val user = db.query("users", mapOf(User::email to Email("hello@example.com"))) { fromValues() }
65+
val user = db.select<User>("users", User::email to Email("hello@example.com"))
6666
```
6767

6868
### Operators
6969

7070
```kotlin
71-
mapOf(User::birthDay to null)
72-
mapOf(User::birthDay to SqlOp("<", someDate))
73-
mapOf(User::age to listOf(1, 2, 3))
71+
User::birthDay to null
72+
User::birthDay to SqlOp("<", someDate)
7473

75-
mapOf(User::birthDay to notNull)
74+
User::age to listOf(1, 2, 3)
7675

77-
mapOf(User::birthDay lte someDate)
78-
mapOf(User::name like "Anton%")
76+
User::birthDay to notNull
77+
User::birthDay lte someDate
7978

80-
mapOf(User::name to SqlExpr("(select ... where x = ?)", x))
79+
User::name like "Anton%"
80+
User::name to SqlExpr("(select ... where x = ?)", x)
8181
```
8282

8383
### Crud operations?

0 commit comments

Comments
 (0)