View Source Electric.Postgres.Inspector behaviour (electric v0.4.4)

Summary

Functions

Clean up column information about a given table using a provided inspector.

Convert a column list into something that can be used by Electric.Replication.Eval.Parser.parse_and_validate_expression/2

Get columns that should be considered a PK for table. If the table has no PK, then we're considering all columns as identifying.

Load column information about a given table using a provided inspector.

Types

@type column_info() :: %{
  name: String.t(),
  type: String.t(),
  type_mod: integer() | nil,
  formatted_type: String.t(),
  pk_position: non_neg_integer() | nil,
  type_id: {typid :: non_neg_integer(), typmod :: integer()},
  array_dimensions: non_neg_integer(),
  not_null: boolean(),
  array_type: String.t()
}
@type inspector() :: {module(), opts :: term()}
@type relation() :: Electric.relation()

Callbacks

Link to this callback

clean_column_info(relation, opts)

View Source
@callback clean_column_info(relation(), opts :: term()) :: true
Link to this callback

load_column_info(relation, opts)

View Source
@callback load_column_info(relation(), opts :: term()) ::
  {:ok, [column_info()]} | :table_not_found

Functions

Link to this function

clean_column_info(relation, arg)

View Source
@spec clean_column_info(relation(), inspector()) :: true

Clean up column information about a given table using a provided inspector.

Link to this function

columns_to_expr(columns)

View Source
@spec columns_to_expr([column_info(), ...]) ::
  Electric.Replication.Eval.Parser.refs_map()

Convert a column list into something that can be used by Electric.Replication.Eval.Parser.parse_and_validate_expression/2

@spec get_pk_cols([column_info(), ...]) :: [String.t(), ...]

Get columns that should be considered a PK for table. If the table has no PK, then we're considering all columns as identifying.

Link to this function

load_column_info(relation, arg)

View Source
@spec load_column_info(relation(), inspector()) ::
  {:ok, [column_info()]} | :table_not_found

Load column information about a given table using a provided inspector.