← Back to Stormify Documentation

readCursor

inline fun <T : Any> readCursor(query: String, vararg params: Any?, customFields: Map<String, (Any?) -> Unit>? = null, noinline consumer: (T) -> Unit): Int

Executes a SELECT query and processes results row-by-row via consumer. Returns row count.

Parameters

customFields

optional per-column interceptors. Any column whose label matches a key (case-insensitively) is passed to the associated lambda instead of being mapped onto the entity, allowing sidecar aggregates (e.g. COUNT(*) OVER () AS __total) to be captured in a single roundtrip without breaking entity mapping. Ignored for Map and scalar result types since those expose every column to the caller directly.