GeoGenius.Providers.Batch (geo_genius v0.2.0)

Copy Markdown View Source

Turns a list of raw items into staged rows, one fun call per item, stopping at the first error.

Shared by every provider's per-chunk staging step: GeoGenius.Providers.GeoJSON builds one GeoGenius.Staging.Row per GeoJSON feature, GeoGenius.Providers.CSV one per delimited data row, and both need the same collect-or-halt, then-reverse machinery -- previously duplicated between them as rows_for/2, collect_row/3, and finish_rows/1, divergent only in how many extra arguments each provider's own row_for needed.

Summary

Functions

Applies fun to every item in items, returning the staged rows in the original order.

Functions

rows(items, fun)

@spec rows([term()], (term() -> {:ok, GeoGenius.Staging.Row.t()} | {:error, term()})) ::
  {:ok, [GeoGenius.Staging.Row.t()]} | {:error, term()}

Applies fun to every item in items, returning the staged rows in the original order.

Stops at the first {:error, reason} fun returns, propagating it rather than staging the remaining items.