Maps Postgres type names into Squirrelix's Elixir type metadata and typespecs.
Postgres enums
Custom Postgres enums (kind: "e") map to the internal atom :string and emit
String.t() in generated @specs. Runtime encode/decode passes enum labels
through as plain strings — Squirrelix does not generate Gleam-style enum ADTs.
JSON and JSONB
JSON columns map to the internal atom :map (shared by json and jsonb) but
emit term() in generated @specs. JSON values are not always objects, and
Postgrex may return maps, lists, or primitives depending on the stored payload.
term() matches Elixir 1.20 practice for dynamically typed JSON columns; row
result maps still use map() with required/1 keys via row_typespec/1.
Summary
Types
@type elixir_type() :: atom() | {:list, elixir_type()}
Functions
@spec column_typespec(atom(), elixir_type(), boolean()) :: String.t()
@spec from_postgres( String.t(), keyword() ) :: {:ok, elixir_type()} | {:error, Squirrelix.Error.UnsupportedPostgresType.t()}
@spec normalize_type(term()) :: {:ok, elixir_type()} | {:error, Squirrelix.Error.UnsupportedPostgresType.t()}
@spec return_typespec([] | [{atom(), elixir_type(), boolean()}]) :: String.t()
@spec row_typespec([{atom(), elixir_type(), boolean()}]) :: String.t()
@spec typespec(elixir_type()) :: String.t()