View Source Electric.LogItems (electric v1.0.0-beta.10)

Defines the structure and how to create the items in the log that the electric client reads.

The log_item() data structure is a map for ease of consumption in the Elixir code, however when JSON encoded (not done in this module) it's the format that the electric client accepts.

Summary

Types

@type log_item() :: %{
  key: String.t(),
  value: map(),
  headers: map(),
  offset: Electric.Replication.LogOffset.t()
}

Functions

Link to this function

from_change(change, txid, pk_cols, replica)

View Source
@spec from_change(
  Electric.Replication.Changes.data_change(),
  txid :: non_neg_integer() | nil,
  pk_cols :: [String.t()],
  replica :: Electric.Shapes.Shape.replica()
) :: [log_item(), ...]
Link to this function

from_snapshot_row_stream(row_stream, offset, shape, query_info)

View Source
@spec from_snapshot_row_stream(
  row_stream :: Enumerable.t(list()),
  offset :: Electric.Replication.LogOffset.t(),
  shape :: Electric.Shapes.Shape.t(),
  query_info :: Postgrex.Query.t()
) :: Enumerable.t(log_item())