View Source Electric.Shapes.Shape (electric v1.0.1)
Struct describing the requested shape
Summary
Functions
List tables that are a part of this shape.
Convert a change to be correctly represented within the shape.
Types
@type flag() :: :selects_all_columns | :non_primitive_columns_in_where
@type json_relation() :: [String.t(), ...]
@type json_safe() :: %{ root_table: json_relation(), root_table_id: non_neg_integer(), root_pk: [String.t(), ...], root_column_count: non_neg_integer(), selects_all_columns?: boolean(), where: String.t(), selected_columns: [String.t(), ...], replica: String.t(), storage: %{required(String.t()) => String.t()} }
@type json_table_info() :: table_info() | json_relation()
@type json_table_list() :: [json_table_info(), ...]
@type replica() :: :full | :default
@type storage_config() :: %{compaction: :enabled | :disabled}
@type t() :: %Electric.Shapes.Shape{ flags: %{optional(flag()) => boolean()}, replica: replica(), root_column_count: non_neg_integer(), root_pk: [String.t(), ...], root_table: Electric.relation(), root_table_id: Electric.relation_id(), selected_columns: [String.t(), ...], storage: storage_config() | nil, where: Electric.Replication.Eval.Expr.t() | nil }
@type table_info() :: %{ columns: [Electric.Postgres.Inspector.column_info(), ...], pk: [String.t(), ...] }
Functions
@spec affected_tables(t()) :: [Electric.relation()]
List tables that are a part of this shape.
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.