Record-transformation and value-preparation helpers shared across the
import paths in ConnectionNotifier.
Three concerns:
value/1andvalue/3— convert JSON-transported scalars back into Postgrex-ready terms. ISO8601 strings become DateTime / Date / Time. Numeric strings are parsed only when the target column is numeric (the 3-arity form): a%Decimal{}for numeric/decimal, a float for double precision/real. The broad 1-arity form (Decimal only) is kept for the PK/unique-key lookup paths where values are known keys, not free-text.numeric_column_types/1— maps each numeric column of a table to:decimalor:float. Cached once per table-import by the importer; empty map on error (safe "don't coerce" fallback).- Record field helpers (
get_field/2,put_field/3,drop_field/2,normalize_keys/1) — records arrive with either string or atom keys depending on whether they came through JSON or internal code. These helpers access/modify fields uniformly without creating atoms from untrusted data.
Extracted from ConnectionNotifier in 2026-04. All functions are pure
or depend only on SchemaInspector (for column introspection) — none
touch HTTP, the socket, or the websocket client.
Summary
Functions
Maps each numeric column of table_name to the term a numeric string in
it should become: :decimal for numeric/decimal, :float for double
precision/real. Empty map on error.
Functions
Maps each numeric column of table_name to the term a numeric string in
it should become: :decimal for numeric/decimal, :float for double
precision/real. Empty map on error.