Filo.Cursor (Filo v0.2.0)

Copy Markdown View Source

Turns a Filo.BatchResult into the sequence of Hrana cursor entries.

A cursor encodes the same information as a BatchResult, but as a stream of per-step entries so a large result need not be held whole in memory:

  • an executed step → a step_begin (with its columns), one row per row, then a step_end (affected rows + last insert rowid);
  • a failed step → a step_error;
  • a skipped step (its condition was false) → no entry.

entries/1 materializes the full list from a completed batch; the connection executor returns whole StmtResults, so true row-streaming would require a streaming executor callback. The entry sequence matches the spec exactly.

Summary

Functions

Builds the ordered list of Hrana cursor entries for a batch result.

Functions

entries(batch_result, opts \\ [])

@spec entries(
  Filo.BatchResult.t(),
  keyword()
) :: [map()]

Builds the ordered list of Hrana cursor entries for a batch result.

With rows: :json, each row entry's payload is a pre-encoded Jason.Fragment (the JSON cursor endpoint's fast path — one line per entry, so per-row tagged maps plus a Jason re-walk dominated the cursor's CPU); the protobuf cursor keeps the default :maps form it can traverse.