Skip to content

Commit a40ffca

Browse files
morisilclaude
andcommitted
Update README example to consume result within transaction scope
This change aligns the example code with best practices by ensuring the Flow is collected within the executeRead block, consistent with recent refactoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f346432 commit a40ffca

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,23 @@ driver.coroutineSession().use { session ->
4343

4444
val person = driver.coroutineSession().use { session ->
4545
session.executeRead { tx ->
46-
tx.run("MATCH (p:Person) RETURN p")
47-
}.records().map { record ->
48-
record["p"].let { p ->
49-
Person(
50-
id = p["id"].asString(),
51-
name = p["name"].asString(),
52-
email = p["email"].asString(),
53-
age = p["age"].asInt(),
54-
city = p["city"].asString(),
55-
skills = p["skills"].asList { it.asString() },
56-
active = p["active"].asBoolean(),
57-
createdAt = p["createdAt"].asInstant()
58-
)
59-
}
60-
}.first()
46+
tx.run(
47+
"MATCH (p:Person) RETURN p"
48+
).records().map { record ->
49+
record["p"].let { p ->
50+
Person(
51+
id = p["id"].asString(),
52+
name = p["name"].asString(),
53+
email = p["email"].asString(),
54+
age = p["age"].asInt(),
55+
city = p["city"].asString(),
56+
skills = p["skills"].asList { it.asString() },
57+
active = p["active"].asBoolean(),
58+
createdAt = p["createdAt"].asInstant()
59+
)
60+
}
61+
}.first()
62+
}
6163
}
6264

6365
println(person)

0 commit comments

Comments
 (0)