SelectoComponents.ExportSnapshots (selecto_components v0.4.5)

Shared snapshot and persistence helpers for export-oriented features.

Exported views and scheduled exports both need the same persisted Selecto view snapshot shape. This module keeps that logic in one place so the query/view reconstruction contract stays consistent across features.

Link to this section Summary

Functions

Build a persisted snapshot payload from current SelectoComponents assigns.

Decode a previously encoded persistence blob.

Encode an arbitrary Elixir term for persistence.

Link to this section Functions

Link to this function

build_snapshot(assigns)

@spec build_snapshot(map()) :: map()

Build a persisted snapshot payload from current SelectoComponents assigns.

Link to this function

decode_term(blob)

@spec decode_term(binary() | nil) ::
  {:ok, term()} | {:error, :invalid_blob | :missing}

Decode a previously encoded persistence blob.

Link to this function

encode_term(term)

@spec encode_term(term()) :: binary()

Encode an arbitrary Elixir term for persistence.