Threadline.Page (Threadline v1.0.0)

Copy Markdown View Source

Threadline.Page represents one page of a Threadline paged read.

Every paged Threadline read — Threadline.timeline_page/2, the row-history, actor-window and correlation-bundle pagers, and Threadline.actor_history/2 — returns this struct. entries are newest first. has_more is exact: it is only ever true when another row is known to exist beyond this page. cursor is nil exactly when has_more is false — a fully drained walk has nothing left to resume from.

Feed cursor back as the :cursor option to continue the walk. Start a walk with cursor: :start. Passing cursor: nil raises ArgumentError — it exists only to prevent a loop that feeds a drained page's cursor back in from silently restarting at the beginning forever.

Summary

Types

A cursor for a paged actor-transaction read (actor_history/2). occurred_at is microsecond precision (utc_datetime_usec), matching AuditTransaction.occurred_at.

A cursor for a paged change read (timeline_page/2, the row-history pagers). captured_at is microsecond precision (utc_datetime_usec), matching AuditChange.captured_at.

Any cursor a paged Threadline read accepts: a forward change or actor cursor, or {:before, actor_cursor()} to walk an actor history backward toward newer records.

t()

A Threadline.Page of unspecified entry type.

A Threadline.Page whose entries are of type entry.

Types

actor_cursor()

(since 1.0.0)
@type actor_cursor() :: %{occurred_at: DateTime.t(), id: Ecto.UUID.t()}

A cursor for a paged actor-transaction read (actor_history/2). occurred_at is microsecond precision (utc_datetime_usec), matching AuditTransaction.occurred_at.

change_cursor()

(since 1.0.0)
@type change_cursor() :: %{captured_at: DateTime.t(), id: Ecto.UUID.t()}

A cursor for a paged change read (timeline_page/2, the row-history pagers). captured_at is microsecond precision (utc_datetime_usec), matching AuditChange.captured_at.

cursor()

(since 1.0.0)
@type cursor() :: change_cursor() | actor_cursor() | {:before, actor_cursor()}

Any cursor a paged Threadline read accepts: a forward change or actor cursor, or {:before, actor_cursor()} to walk an actor history backward toward newer records.

t()

(since 1.0.0)
@type t() :: t(term())

A Threadline.Page of unspecified entry type.

t(entry)

(since 1.0.0)
@type t(entry) :: %Threadline.Page{
  cursor: cursor() | nil,
  entries: [entry],
  has_more: boolean()
}

A Threadline.Page whose entries are of type entry.