Commit 253a297
New Neo4jOperations access layer, object mapping, full test coverage, fix critical bugs and improve error handling (#17)
* Fix critical bugs and improve error handling
This commit addresses several issues found during code review:
**Critical Fixes:**
- Fix missing TransactionConfig parameter in InternalSession
Previously, executeRead() and executeWrite() methods accepted a
TransactionConfig parameter but did not pass it to the underlying
Neo4j async methods. This caused transaction timeouts, metadata,
and other configuration settings to be silently ignored.
(src/main/kotlin/internal/InternalSession.kt:45, 56)
**Medium Priority Fixes:**
- Add consumption tracking to InternalResult.single()
The single() method now uses the same AtomicBoolean mechanism as
records() to prevent multiple consumption attempts and ensure
consistent resource management.
(src/main/kotlin/internal/InternalResult.kt:59-69)
**User Experience Improvements:**
- Improve error messages in NodeMapping.toObject()
Enhanced error message when attempting to convert unsupported Value
types, providing clear guidance on how to fix the issue with
examples of common mistakes.
(src/main/kotlin/NodeMapping.kt:130-134)
- Add documentation to SessionConfigBuilder
Added KDoc warnings to bookmarks and bookmarkManager properties
explaining their mutual exclusivity and that bookmarkManager takes
precedence when both are set.
(src/main/kotlin/Session.kt:563-597)
All changes verified with passing tests and API compatibility checks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Add kotlinx.serialization mapping and Neo4jOperations API
This commit adds comprehensive object mapping support using
kotlinx.serialization and a high-level operations API.
**New Features:**
Object Mapping (NodeMapping.kt):
- toProperties(): Convert @serializable objects to Neo4j property maps
- toObject<T>(): Convert Neo4j nodes/relationships to Kotlin objects
- Support for primitives, lists, enums, and kotlin.time.Instant
- Validates against unsupported nested structures with clear errors
High-Level API (Neo4jOperations.kt):
- DispatchedNeo4jOperations: Session lifecycle management
- Convenience methods: read(), write(), withSession()
- Flow-based streaming with automatic resource cleanup
- populate(): Quick test data insertion
**API Changes:**
- Result.singleOrNull(): Extension function for optional single records
- Session.flow(): Streaming query results in read transactions
- Updated API surface (api/xemantic-neo4j-kotlin-driver.api)
**Dependencies:**
- Added kotlinx-serialization-core (API dependency)
- Added xemantic-kotlin-core for SuspendCloseable
- Removed local SuspendCloseable implementation
**Testing:**
- Comprehensive test coverage for mapping and operations
- Performance benchmarks for Result streaming
- Integration tests for round-trip serialization
- README examples as executable tests
**Build:**
- Updated Gradle wrapper to 9.2
- Dependency version updates
- GitHub Actions workflow improvements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent b73aab5 commit 253a297
File tree
29 files changed
+4769
-837
lines changed- .github/workflows
- api
- gradle
- wrapper
- src
- main/kotlin
- internal
- test/kotlin
29 files changed
+4769
-837
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 47 | + | |
59 | 48 | | |
60 | 49 | | |
61 | 50 | | |
| |||
70 | 59 | | |
71 | 60 | | |
72 | 61 | | |
73 | | - | |
74 | | - | |
| 62 | + | |
| 63 | + | |
75 | 64 | | |
76 | | - | |
| 65 | + | |
77 | 66 | | |
78 | 67 | | |
79 | | - | |
80 | | - | |
| 68 | + | |
| 69 | + | |
0 commit comments