Sheetshow.Table.Row (Sheetshow v0.1.0)

Copy Markdown View Source

One row of a table: an id, what it says, and where on the tab it sits.

row is the sheet row this was read from, and unlike a log's, it is load bearing: it is how a later write finds this record again. It is only ever true of the snapshot it came in: a row somebody inserts above moves it, and Sheetshow.Table.refresh/2 is what finds out.

errors maps a column name to a Sheetshow.Error. A cell that would not cast leaves its field nil and says so here rather than taking the read down; so does a row with no id, and a row whose id another row already used.

This is deliberately not Sheetshow.Log.Event, though the fields line up. An event is a line of history you never edit; a row is a place on a tab you write over. The two models share the reading machinery underneath, not the vocabulary on top.

Summary

Functions

Whether anything on this row would not read.

Types

t()

@type t() :: %Sheetshow.Table.Row{
  deleted: boolean(),
  errors: %{optional(Sheetshow.Schema.name()) => Sheetshow.Error.t()},
  id: String.t() | nil,
  record: Sheetshow.Schema.fields(),
  row: non_neg_integer() | nil
}

Functions

errors?(row)

@spec errors?(t()) :: boolean()

Whether anything on this row would not read.

iex> Sheetshow.Table.Row.errors?(%Sheetshow.Table.Row{id: "a"})
false