clj-r2dbc.impl.sql.cursor
RowCursor flyweight and generation guard for clj-r2dbc streaming.
Provides:
Cursor - protocol for type-safe access to mutable RowCursor fields.
GenerationGuard - Row wrapper built by cursor-row; guards against stale reads
after the cursor advances to the next row.
RowCursor - shared mutable flyweight constructed once per stream* call;
reused for every row emitted.
Note: RowCursor is a shared mutable object. The same instance is mutated for
every row emitted by stream*. Retaining a reference to the cursor beyond the
current m/?> boundary silently returns data from a later row - no exception is
thrown. Callers that need to keep row data must either:
(a) supply :builder-fn (recommended) to materialize an immutable value, or
(b) call cursor-row and cursor-cache immediately within the same reduce step
and pass them to impl/sql/row's row->map before the next row arrives.
This namespace is an implementation detail; do not use from application code.Cursor
protocol
Protocol for type-safe access to RowCursor's mutable fields.
Used by callers that consume the flyweight cursor directly (e.g., tests,
custom reduction functions).
members
-set-cache!
(-set-cache! this cache)
Internal: update the RowMetadataCache in place.
-set-row!
(-set-row! this row)
Internal: enqueue row for the next consumer step.
cursor-cache
(cursor-cache this)
Return the current RowMetadataCache.
cursor-generation
(cursor-generation this)
Return the monotonic cursor generation.
cursor-row
(cursor-row this)
Return the current Row (valid only within the current step).