View Source Electric.Shapes.Shape (electric v0.9.5)

Struct describing the requested shape

Summary

Types

@type json_relation() :: [String.t(), ...]
@type json_safe() :: %{
  root_table: json_relation(),
  root_table_id: non_neg_integer(),
  where: String.t(),
  selected_columns: [String.t(), ...] | nil,
  table_info: [json_table_list(), ...]
}
@type json_table_info() :: table_info() | json_relation()
@type json_table_list() :: [json_table_info(), ...]
@type replica() :: :full | :default
@type t() :: %Electric.Shapes.Shape{
  replica: replica(),
  root_table: Electric.relation(),
  root_table_id: Electric.relation_id(),
  selected_columns: [String.t(), ...] | nil,
  table_info: %{required(Electric.relation()) => table_info()},
  where: Electric.Replication.Eval.Expr.t() | nil
}
@type table_info() :: %{
  columns: [Electric.Postgres.Inspector.column_info(), ...],
  pk: [String.t(), ...]
}
Link to this type

table_with_where_clause()

View Source
@type table_with_where_clause() :: {Electric.relation(), String.t() | nil}

Functions

@spec affected_tables(t()) :: [table_with_where_clause()]

List tables that are a part of this shape.

Link to this function

convert_change(shape, change)

View Source

Convert a change to be correctly represented within the shape.

New or deleted changes are either propagated as-is, or filtered out completely. Updates, on the other hand, may be converted to an "new record" or a "deleted record" if the previous/new version of the updated row isn't in the shape.

@spec from_json_safe!(json_safe()) :: t() | no_return()
Link to this function

is_affected_by_relation_change?(arg1, arg2)

View Source
Link to this function

pk(shape, relation \\ nil)

View Source
@spec to_json_safe(t()) :: json_safe()